refactored database calls out of contact routes