public boolean removeSubWork(Activity a) {
   if (super.removeSubWork(a)) {
     a.setParent(null);
     return true;
   }
   return false;
 }
 public boolean addSubWork(Activity a) {
   if (super.addSubWork(a)) {
     a.setParent(this);
     return true;
   }
   return false;
 }
  public boolean removeModelElement(ModelElement e) {
    if (e instanceof Activity) {
      Activity a = (Activity) e;
      Collection links = ApesMediator.getInstance().getLinks(mFlowDiagram, getOwner());
      if (getOwner() != null && !contains(links, a)) {
        if (getOwner() != null && getOwner().containsFeature(a)) {
          getOwner().removeFeature(a);
        }
        a.setOwner(null);
      }
      return removeSubWork((Activity) e);
    }
    if (e instanceof FlowDiagram && mFlowDiagram == (FlowDiagram) e) {
      return removeFlowDiagram();
    }
    if (e instanceof ActivityDiagram && mActivityDiagram == (ActivityDiagram) e) {
      return removeActivityDiagram();
    }

    return false;
  }
  public boolean addModelElement(ModelElement e) {
    if (e instanceof Activity) {
      Activity a = (Activity) e;
      if (addSubWork(a)) {
        if (a.getOwner() == null && getOwner() != null) {
          if (getOwner() != null && !getOwner().containsFeature(a)) {
            getOwner().addFeature(a);
          }
          a.setOwner(getOwner());
        }
        return true;
      }
      return false;
    }
    if (e instanceof FlowDiagram) {
      return addFlowDiagram((FlowDiagram) e);
    }
    if (e instanceof ActivityDiagram) {
      return addActivityDiagram((ActivityDiagram) e);
    }

    return false;
  }