refactor db base class