How should clone with subtasks be implemented?

In order to properly clone a task with subtask, I need to do the following:
1. clone the parent
2. sync the new parent to the cloud
3. get the id that is assigned by toodledo
4. clone all the subtasks to be under this parent

Steps #2 and #3 is problematic, as network connection is needed, and its a very "async" task. Is there any way to accomplish this cloning of subtasks without making a roundtrip to the web?

1) Clone the parent and give it a temporary id
2) Clone all the subtasks and give them temporary ids and set their parent id to be the new parent's temporary id.

At this point, the user can continue to use your app offline, making any changes to the parent/subtasks as needed. Then, when ready to sync:

3) Sync the parent and get the new id
4) Update the parent's temporary id with the real id
5) Update all the subtask's temporary parent id to the real parent id
6) Sync the subtasks
7) Update the subtasks's temporary ids with the real ids.

Its not special code. Just use your languages built in random number generator. Or concatenate several small random numbers together into a long string. It doesn't really matter as long as it is unique.