edit the functionality for inserting data to the database