Added update_database function, performs a slightly different action compared to write_to_databse, but figure out how to work with the upsert parameter and get records updating