Finished logic for inserting data into all 3 tables,