Add-on porting notes for Anki 2.1.45

I’m not sure if I understand how to port an existing add-on to use the new CollectionOp system. Let’s say I have a card, and I want to change its due. Before I would write something like this:

browser.model.beginReset()
mw.checkpoint("Change due")

card.due = int(time.time())
card.flush()

browser.model.endReset()
mw.reset()

But how do I translate it to the new system without losing the ability to undo the change?

Additionally, what if I have multiple cards that I need to change, but add only one undo entry?