protected void writeEventDefinitions(List<EventDefinition> eventDefinitions, XMLStreamWriter xtw)
     throws Exception {
   for (EventDefinition eventDefinition : eventDefinitions) {
     if (eventDefinition instanceof TimerEventDefinition) {
       writeTimerDefinition((TimerEventDefinition) eventDefinition, xtw);
     } else if (eventDefinition instanceof SignalEventDefinition) {
       writeSignalDefinition((SignalEventDefinition) eventDefinition, xtw);
     } else if (eventDefinition instanceof MessageEventDefinition) {
       writeMessageDefinition((MessageEventDefinition) eventDefinition, xtw);
     } else if (eventDefinition instanceof ErrorEventDefinition) {
       writeErrorDefinition((ErrorEventDefinition) eventDefinition, xtw);
     }
   }
 }
 protected void writeEventDefinitions(
     Event parentEvent,
     List<EventDefinition> eventDefinitions,
     BpmnModel model,
     XMLStreamWriter xtw)
     throws Exception {
   for (EventDefinition eventDefinition : eventDefinitions) {
     if (eventDefinition instanceof TimerEventDefinition) {
       writeTimerDefinition(parentEvent, (TimerEventDefinition) eventDefinition, xtw);
     } else if (eventDefinition instanceof SignalEventDefinition) {
       writeSignalDefinition(parentEvent, (SignalEventDefinition) eventDefinition, xtw);
     } else if (eventDefinition instanceof MessageEventDefinition) {
       writeMessageDefinition(parentEvent, (MessageEventDefinition) eventDefinition, model, xtw);
     } else if (eventDefinition instanceof ErrorEventDefinition) {
       writeErrorDefinition(parentEvent, (ErrorEventDefinition) eventDefinition, xtw);
     } else if (eventDefinition instanceof TerminateEventDefinition) {
       writeTerminateDefinition(parentEvent, (TerminateEventDefinition) eventDefinition, xtw);
     }
   }
 }