Added new document transaction logic