Age old problem,
How do I get the ID for the thing I just wrote.
@@Identity immediately after the insert works but you do need a return trip from the database.
If the Database is not going to be Mammoth I suggest using a GUID you can create that on your client then just send it along with the insert. use it for the children etc. with no return trip.
HTH
Tal McMahon