Added contextmanager for transactional scope