refactored for UnitOfWork pattern