Transactions refactoring

Add a transaction manager per connection, so it can controls the
connection responsibilities.