         }
         
         /* Objects can only be deleted in transactions, similar to object modification. */
-        Cd.transact {
-            guard let txItem = Cd.useInCurrentContext(item) else {
+        Cd.transactWith(item) { txItem in
+            guard let item = txItem else {
                 return
             }
             
-            Cd.delete(txItem)
+            Cd.delete(item)
         }
     }
 }

           An implicit commit occurs when the transaction is complete and changes are
           written to disk.  The main thread context is notified of this change and
           the fetch controller will updated automatically in the main thread. */
        Cd.transact {
            guard let txItem = Cd.useInCurrentContext(item) else {
                return
            }
            
            txItem.numberTaps += 1
        }
        
    }

            
            try! Cd.commit()
            
            Cd.onMainWith(newItem) { mainItem in
                guard let item = mainItem else {
                    return
                }
                
                print("created item in transaction: \(item.name)")
                item.updateHandler = { event in
                    print("event occurred on object \(item.name): \(event)")
                }
            }
        }
