implementing id/cid matching

when syncing an item db -> api, it's possible that the call is made and
the client is terminated before the response is terminate. this is
highly improbably due to the strict timing required, but possible.

however, the api saves the cid of the item, and when calling sync, will
return it. this allows us to match the "real" item (with the real ID) to
the local item that has only a cid. otherwise it would be orphaned.