Fixed issues with generating devicekey values, and managing sync with
server.
Only set devicekey for server sync if inserting records.  Updates will
retain the existing devicekey, or already have correct server key
relationship in place on the record.