refactor dbmodel