refactoring model db