Refactor db services