added database insert code, and update for contact