Refactor DbManager