Refactor Transaction to be event-driven, now events can be bound to a
transaction.

Added a Transaction->deferEvents() to easily wire up an events object to
be corked during a transaction and uncorked when the transaction
commits/rollsback.