Adding records back into the transactions for those records with callback functions defined.
Made changes so that transaction state tells whether the parent transaction is closed.