public async Task RefreshAsync(T instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            MobileServiceSerializer serializer = this.MobileServiceClient.Serializer;
            object objId = serializer.GetId(instance, ignoreCase: false, allowDefault: true);

            if (objId == null)
            {
                return; // refresh is not supposed to throw if your object does not have an id for some reason
            }

            string id = EnsureIdIsString(objId);

            // Get the latest version of this element
            JObject refreshed = await base.LookupAsync(id);

            if (refreshed == null)
            {
                throw new InvalidOperationException(
                          string.Format(
                              CultureInfo.InvariantCulture,
                              "Item not found in local store."));
            }

            // Deserialize that value back into the current instance
            serializer.Deserialize <T>(refreshed, instance);
        }
        public async Task InsertAsync(T instance)
        {
            MobileServiceSerializer serializer = this.MobileServiceClient.Serializer;

            var value = serializer.Serialize(instance) as JObject;

            // remove system properties since the jtoken insert overload doesn't remove them
            value = RemoveSystemPropertiesKeepVersion(value);

            JObject inserted = await base.InsertAsync(value);

            serializer.Deserialize(inserted, instance);
        }