Refactor UnitOfWork