refactoring ContactDatabase class