if (parent instanceof CPItem) {
CPItem p = (CPItem) parent;
p.addItemAt((CPItem) newElement, beforeItem.getPosition() + 1);
} else if (parent instanceof CPOrganization) {
CPOrganization o = (CPOrganization) parent;
o.addItemAt((CPItem) newElement, beforeItem.getPosition() + 1);
} else {
throw new OLATRuntimeException(CPOrganizations.class, "you cannot add an <item> element to a " + parent.getName() + " element",
new Exception());
}