Refactoring DatabaseManager