refactoring: separate addCommas from generateUpdateOrInsertPhrase (and apply to where phrase)