New function for inserting the data