internal SyncStatusDbContext CreateSyncStatusContext()
        {
            // var connectionString = Database.Connection.ConnectionString;
            var syncStatusContext = new SyncStatusDbContext(_nameOrConnectionString);

            return(syncStatusContext);
        }
        private SyncStatusServerObject AddOrCreateNewSyncObject(SyncStatusDbContext syncStatusContext, string type, string mobilePrimaryKey)
        {
            var syncObj = syncStatusContext.SyncStatusServerObjects.Find(type, mobilePrimaryKey);

            if (syncObj == null)
            {
                syncObj = new SyncStatusServerObject(type, mobilePrimaryKey);
                syncStatusContext.SyncStatusServerObjects.Add(syncObj);
            }
            return(syncObj);
        }
        private void AttachObject(IRealmiusObjectServer obj, SyncStatusDbContext syncStatusContext, UpdatedDataBatch updatedResult)
        {
            var typeName = GetEfTypeName(obj);
            var syncObj  = AddOrCreateNewSyncObject(syncStatusContext, typeName, obj.MobilePrimaryKey);

            var current = JObject.FromObject(obj);
            var diff    = JsonHelper.GetJsonDiff(JObject.Parse(syncObj.FullObjectAsJson ?? "{}"), current);

            var dateTimeNow = GetDate();

            foreach (JProperty jProperty in diff.Properties())
            {
                syncObj.ColumnChangeDates[jProperty.Name] = dateTimeNow;
            }

            ProcessAndAddChanges(syncObj, obj, updatedResult, diff.ToString());
        }