move logic for atomically inserting into a new record to the server'