Refactoring about DB