Record data to database.