Finish the refactor to move the db operations into a service