How to exclude specific actions in undo , redo chain?

Hi,
Here is my flow

let bpmnEvents = [
‘shape.added’,
‘connection.added’
];

this.bpmnjs= new bpmnjs()

when shape / connection creates I’m modifying the id of bpmn shape, sequence flow

bpmnEvents.forEach(bpmnEvent => this.getEventBus().on(bpmnEvent, this.modifyElemId));

modifyElemId = (event) => {
const elem = event.element;
let uid = this.helperUtil.createAwdUID(); // this is the custome ID as per requirement
setTimeout(() =>{
this.bpmnJS.get(‘modeling’).updateProperties(elem, { id: uid }); // //modifying the bpmnId to customID
});

}