beginning of saving data into database