factoring out the diffing from the generator for updating the database