Saving tasks to the database.