Undo without delete

Hi! I use ymap to store the state of an object. In my application, I want to provide the ability to restore deleted objects, so I’m thinking of adding an isDeleted field to the state, which will be stored like all other fields in ymap. Everything seems to be fine, except for undo/redo. Previously, when creating a new yMap, undo deleted it, but now I don’t like this behavior. I need that after creating a new yMap, undo only updates the field in it to isDeleted=true. To solve this, the only thing that comes to my mind is to split the creation into 2 stages. First create yMap (without saving in UndoManager), and then update isDeleted=false. But these will be 2 different transactions, maybe there is a better way?