Needs fine tuning when trying to save data in the database.