Update script to write results to the database.