added inserting into database function