         }
 
         if operations.contains(.update) {
-            let updatedObjectIDs = Array(remotePrimaryKeysSet.intersection(localPrimaryKeysSet))
+            var intersection = Set(remotePrimaryKeysWithoutNils)
+            intersection.formIntersection(Set(localPrimaryKeys))
+            let updatedObjectIDs = Array(intersection)
 
             for fetchedID in updatedObjectIDs {
                 let JSON = remotePrimaryKeysAndChanges[fetchedID]!

            remotePrimaryKeysAndChanges[primaryKey] = change
        }

        let remotePrimaryKeysSet = Set(remotePrimaryKeysWithoutNils)
        let localPrimaryKeysSet = Set(localPrimaryKeys)

        if operations.contains(.delete) {
            let deletedObjectIDs = Array(localPrimaryKeysSet.subtracting(remotePrimaryKeysSet))

            for fetchedID in deletedObjectIDs {
                let objectID = primaryKeysAndObjectIDs[fetchedID]!

        }

        if operations.contains(.insert) {
            var insertedObjectIDs = remotePrimaryKeysWithoutNils
            insertedObjectIDs = insertedObjectIDs.filter { value in
                !localPrimaryKeys.contains { $0.isEqual(value) }
            }

            for fetchedID in insertedObjectIDs {
                let objectDictionary = remotePrimaryKeysAndChanges[fetchedID]!
