refactor db handlers to use base class