value.addUnique(index, copyReferencedEObject);
copyEObject.eSet(getTarget(eReference), copyReferencedEObject);
    protected void copyReference(EReference eReference, EObject eObject, EObject copyEObject)    {      boolean isBidirectional = eReference.getEOpposite() != null;      if (eReference.isMany())      {        InternalEList value = (InternalEList)copyEObject.eGet(getTarget(eReference));        int index = 0;        for (Iterator k = ((List)eObject.eGet(eReference)).iterator(); k.hasNext();)        {          Object referencedEObject = k.next();          Object copyReferencedEObject = get(referencedEObject);          if (copyReferencedEObject == null)          {            if (!isBidirectional)            {              value.addUnique(index, referencedEObject);              ++index;            }          }          else          {            if (isBidirectional)            {              int position = value.indexOf(copyReferencedEObject);              if (position == -1)              {                value.addUnique(index, copyReferencedEObject);              }              else if (index != position)              {                value.move(index, copyReferencedEObject);              }            }            else            {              value.addUnique(index, copyReferencedEObject);            }            ++index;          }        }      }      else      {        Object referencedEObject = eObject.eGet(eReference);        if (referencedEObject == null)        {          if (eObject.eIsSet(eReference))          {            copyEObject.eSet(getTarget(eReference), null);          }        }        else        {          Object copyReferencedEObject = get(referencedEObject);          if (copyReferencedEObject == null)          {            if (!isBidirectional)            {              copyEObject.eSet(getTarget(eReference), referencedEObject);            }          }          else          {            copyEObject.eSet(getTarget(eReference), copyReferencedEObject);          }        }      }    }