                     for index in insertions {
                         
                         let object = results[index]
-                        let identifier = object.value(forKey: primaryKey) as! String
+                        let identifier = getIdentifier(for: object, primaryKey: primaryKey)
                         /* This can be called during a transaction, and it's illegal to add a notification block during a transaction,
                          * so we keep all the insertions in a list to be processed as soon as the realm finishes the current transaction
                          */

        
        let objectClass = realmObjectClass(name: object.objectSchema.className)
        let primaryKey = objectClass.primaryKey()!
        let identifier = object.objectSchema.className + "." + (object.value(forKey: primaryKey) as! String)
        return getSyncedEntity(objectIdentifier: identifier, realm: realm)
    }
    
    func getSyncedEntity(objectIdentifier: String, realm: Realm) -> SyncedEntity? {

            
            // Register for object updates
            for object in results {
                
                let identifier = getIdentifier(for: object, primaryKey: primaryKey)
                let token = object.observe({ [weak self] (change) in
                    
                    switch change {
