Write new data to the database.