Refactoring in db classes