Thanks @Chris,
Its returning the correct id which was last inserted. Only concern is that will it return another id if someone else did an insert from another application session at the same time? I hope that its restricted to the current user session only.
Enter the destination URL
Or link to existing content