Saving the session data in the database