private Association CreateSubSetAssociation(Classifier associationTarget, Association existingAssociation)
        {
            Association subSetAssociation;

            if (existingAssociation == null)
            {
                subSetAssociation = this.model.factory.createNewElement <UML.Classes.Kernel.Association>
                                        (this.owner.subsetElement, this.sourceAssociation.name);
                subSetAssociation.addRelatedElement(associationTarget);
            }
            else
            {
                subSetAssociation = existingAssociation;
            }
            //update name
            subSetAssociation.name = this.sourceAssociation.name;
            //notes only update them if they are empty
            if (subSetAssociation.ownedComments.Count == 0 || !subSetAssociation.ownedComments.Any(x => x.body.Length > 0))
            {
                subSetAssociation.ownedComments = this.sourceAssociation.ownedComments;
                if (this.owner.owner.settings.prefixNotes &&
                    this.owner.owner.settings.prefixNotesText.Length > 0 &&
                    subSetAssociation.ownedComments.Any(x => x.body.Length > 0))
                {
                    foreach (var comment in subSetAssociation.ownedComments)
                    {
                        comment.body = this.owner.owner.settings.prefixNotesText + Environment.NewLine + comment.body;
                    }
                }
            }
            //stereotype
            subSetAssociation.stereotypes = this.sourceAssociation.stereotypes;
            //save all changes
            subSetAssociation.save();
            //copy the association end properties
            //copy source end properties
            this.copyAssociationEndProperties((UTF_EA.AssociationEnd) this.thisEnd,
                                              ((UTF_EA.Association)subSetAssociation).sourceEnd);
            //copy target end properties
            this.copyAssociationEndProperties((UTF_EA.AssociationEnd) this.otherEnd,
                                              ((UTF_EA.Association)subSetAssociation).targetEnd);
            //set the target multiplicity to a possible redefined multiplicity from the schema
            ((UTF_EA.Association)subSetAssociation).targetEnd.multiplicity = this.multiplicity;
            //save all changes
            subSetAssociation.save();
            //copy tagged values
            ((EASchema)this.owner.owner).copyTaggedValues((UTF_EA.Element) this.sourceAssociation, (UTF_EA.Element)subSetAssociation);
            //((UTF_EA.Association)this.subsetAssociation).copyTaggedValues((UTF_EA.Association)this.sourceAssociation);
            //add tagged value with reference to source association
            ((UTF_EA.Association)subSetAssociation).addTaggedValue(
                this.owner.owner.settings.sourceAssociationTagName, ((UTF_EA.Association) this.sourceAssociation).guid);

            subSetAssociation.save();
            return(subSetAssociation);
        }
        /// <summary>
        /// add the subset association to the list if it does not exist
        /// </summary>
        /// <param name="associationTarget">the target for the association</param>
        private void addSubsetAssociation(Classifier associationTarget)
        {
            Association existingAssociation = this.subsetAssociations.FirstOrDefault(x => ((UTF_EA.Association)x).target.Equals(associationTarget));
            Association subsetAssociation   = CreateSubSetAssociation(associationTarget, existingAssociation);

            if (existingAssociation == null &&
                subsetAssociation != null)
            {
                this.subsetAssociations.Add(subsetAssociation);
            }
        }
        /// <summary>
        /// add the subset association to the list if it does not exist
        /// </summary>
        /// <param name="associationTarget">the target for the association</param>
        private void addSubsetAssociation(Classifier associationTarget)
        {
            Association existingAssociation = this.subsetAssociations.FirstOrDefault(x => ((UTF_EA.Association)x).target.Equals(associationTarget));
            Association subsetAssociation   = CreateSubSetAssociation(associationTarget, existingAssociation);

            if (existingAssociation == null &&
                subsetAssociation != null)
            {
                this.subsetAssociations.Add(subsetAssociation);
            }
            //if the association is part of an associationclass then create the link
            this.setAssociationClassProperties();
        }
        private Association CreateSubSetAssociation(Classifier associationTarget, Association existingAssociation)
        {
            Association subSetAssociation;
            if (existingAssociation == null)
            {
               		subSetAssociation = this.model.factory.createNewElement<UML.Classes.Kernel.Association>
               		 					(this.owner.subsetElement,this.sourceAssociation.name);
               		subSetAssociation.addRelatedElement(associationTarget);
            }
            else
            {
                //TODO: check and report differences
            //        		if (this._sourceAssociation.sourceEnd.multiplicity != subSetAssociation.
              		subSetAssociation = existingAssociation;
            }
               	//update name
            subSetAssociation.name = this.sourceAssociation.name;
            //notes only update them if they are empty
            if (subSetAssociation.ownedComments.Count == 0 || ! subSetAssociation.ownedComments.Any(x => x.body.Length > 0))
            {
                subSetAssociation.ownedComments = this.sourceAssociation.ownedComments;
                if (this.owner.owner.settings.prefixNotes
                    && this.owner.owner.settings.prefixNotesText.Length > 0
                    && subSetAssociation.ownedComments.Any(x => x.body.Length > 0))
                {
                    foreach (var comment in subSetAssociation.ownedComments)
                    {
                        comment.body = this.owner.owner.settings.prefixNotesText + Environment.NewLine + comment.body;
                    }
                }
            }
            //stereotype
            subSetAssociation.stereotypes = this.sourceAssociation.stereotypes;
            //save all changes
            subSetAssociation.save();
            //copy the association end properties
            //copy source end properties
            this.copyAssociationEndProperties((UTF_EA.AssociationEnd)this.thisEnd,
                ((UTF_EA.Association)subSetAssociation).sourceEnd);
            //copy target end properties
            this.copyAssociationEndProperties((UTF_EA.AssociationEnd)this.otherEnd,
                ((UTF_EA.Association)subSetAssociation).targetEnd);
            //set the target multiplicity to a possible redefined multiplicity from the schema
            ((UTF_EA.Association)subSetAssociation).targetEnd.multiplicity = this.multiplicity;
            //save all changes
            subSetAssociation.save();
            //copy tagged values
            ((EASchema) this.owner.owner).copyTaggedValues((UTF_EA.Element)this.sourceAssociation,(UTF_EA.Element)subSetAssociation);
            //((UTF_EA.Association)this.subsetAssociation).copyTaggedValues((UTF_EA.Association)this.sourceAssociation);
            //add tagged value with reference to source association
            ((UTF_EA.Association)subSetAssociation).addTaggedValue(
                this.owner.owner.settings.sourceAssociationTagName, ((UTF_EA.Association)this.sourceAssociation).guid);

            subSetAssociation.save();
            return subSetAssociation;
        }