public static void initEndEvent(BpmnModelInstance modelInstance, string endEventId) { EndEvent endEvent = modelInstance.getModelElementById(endEventId); TerminateEventDefinition terminateDefinition = modelInstance.newInstance(typeof(TerminateEventDefinition)); endEvent.addChildElement(terminateDefinition); }