@Override
  public Object[] create(ICreateContext context) {
    ServiceTask newServiceTask = new ServiceTask();
    newServiceTask.setName("Service Task");
    newServiceTask.setExtensionId(customServiceTaskId);

    // Process custom service tasks
    if (newServiceTask.isExtended()) {

      CustomServiceTask targetTask = findCustomServiceTask(newServiceTask);

      if (targetTask != null) {

        // Create custom property containing task name
        CustomProperty customServiceTaskProperty = new CustomProperty();

        customServiceTaskProperty.setId(
            ExtensionUtil.wrapCustomPropertyId(
                newServiceTask, ExtensionConstants.PROPERTY_ID_CUSTOM_SERVICE_TASK));
        customServiceTaskProperty.setName(ExtensionConstants.PROPERTY_ID_CUSTOM_SERVICE_TASK);
        customServiceTaskProperty.setSimpleValue(this.customServiceTaskId);

        newServiceTask.getCustomProperties().add(customServiceTaskProperty);
        newServiceTask.setImplementation(targetTask.getRuntimeClassname());
        newServiceTask.setName(targetTask.getName());
      }
    }

    addObjectToContainer(context, newServiceTask, newServiceTask.getName());

    return new Object[] {newServiceTask};
  }
  private CustomServiceTask findCustomServiceTask(ServiceTask serviceTask) {
    CustomServiceTask result = null;

    if (serviceTask.isExtended()) {

      final List<CustomServiceTask> customServiceTasks =
          ExtensionUtil.getCustomServiceTasks(ActivitiUiUtil.getProjectFromDiagram(getDiagram()));

      for (final CustomServiceTask customServiceTask : customServiceTasks) {
        if (serviceTask.getExtensionId().equals(customServiceTask.getId())) {
          result = customServiceTask;
          break;
        }
      }
    }
    return result;
  }