Store multiple items to collection via dataset


I’m using a repeater connected to a dataset to display several items from the collection.
As the user may change one or more items on the repeater, I want to save all of these changes in one button click.
Is there an example how this should be done?

Currently I’m doing the following:
while ($w( “#datasetPerson” ).hasNext()) {
var myPromise = await $w( “#datasetPerson” ).next()

The this saved all the items regardless if there were changed.

Is there a better way? is there a way to know for a specific item whether it was changed or not?

BTW - save() of dataset saved only the current item.