refactoring database mappings