refactored database calls out of contact group routes