Attached events are removed when I replace the element

Hello,

I added a new event type named magic:MagicEvent and the superclass is bpmn:BoundaryEvent. When I attach the new event it gets attached to the task however if I replace the task the event gets deleted how can I keep the event ?

What does your model extension look like?

{
  "name": "MagicSpell",
  "uri": "https://example.com",
  "prefix": "magic",
  "xml": {
    "tagAlias": "lowerCase"
  },
  "types": [
   {
      "name": "MagicEvent",
      "superClass": ["bpmn:BoundaryEvent"],
      "properties": []
    }
  ],
  "enumerations": [],
  "associations": []
}