            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
+        Cd.transactWith(item) { txItem in
+            txItem?.numberTaps += 1
         }
         
     }

            
            try! Cd.commit()
            
            dispatch_async(dispatch_get_main_queue()) {
                if let mainItem = Cd.useInCurrentContext(newItem), name = mainItem.name {
                    print("created item in transaction: \(name)")
                    mainItem.updateHandler = { event in
                        print("event occurred on object \(name): \(event)")
                    }
                }
            }
        }

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