/// <summary>
        /// Returns a collection of ModelTreeChildElementCreationInfo for the given domain class.
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        public static Collection <ModelTreeChildElementCreationInfo> GetModelTreeChildElementCreationInfo(DomainClass d)
        {
            DomainClass domainClass = d;
            SortedDictionary <string, ModelTreeChildElementCreationInfo> connections = new SortedDictionary <string, ModelTreeChildElementCreationInfo>();
            Collection <ModelTreeChildElementCreationInfo> connectionsRet            = new Collection <ModelTreeChildElementCreationInfo>();

            foreach (DomainRole r in domainClass.RolesPlayed)
            {
                if (r.Relationship is EmbeddingRelationship && r.Relationship.Source == r && r.Relationship.InheritanceModifier != InheritanceModifier.Abstract)
                {
                    EmbeddingRelationship emb = r.Relationship as EmbeddingRelationship;

                    ModelTreeChildElementCreationInfo info    = new ModelTreeChildElementCreationInfo();
                    List <AttributedDomainElement>    classes = new List <AttributedDomainElement>();
                    info.Role           = r.Opposite;
                    info.TargetElements = new List <AttributedDomainElement>();

                    if (emb.Target.RolePlayer.InheritanceModifier != InheritanceModifier.Abstract)
                    {
                        classes.Add(emb.Target.RolePlayer);
                    }

                    connections.Add(emb.Target.Name, info);

                    // include derived classes o the child side
                    AttributedDomainElement child = emb.Target.RolePlayer;
                    classes.AddRange(GetNonAbstractDerivedElements(child));

                    // sort by inheritance
                    info.TargetElements.AddRange(SortDomainClassesByInheritance(classes));
                }
            }

            foreach (string key in connections.Keys)
            {
                connectionsRet.Add(connections[key]);
            }

            return(connectionsRet);
        }
        /// <summary>
        /// Returns a collection of ModelTreeChildElementCreationInfo for the given domain class.
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        public static Collection<ModelTreeChildElementCreationInfo> GetModelTreeChildElementCreationInfo(DomainClass d)
        {
            DomainClass domainClass = d;
            SortedDictionary<string, ModelTreeChildElementCreationInfo> connections = new SortedDictionary<string, ModelTreeChildElementCreationInfo>();
            Collection<ModelTreeChildElementCreationInfo> connectionsRet = new Collection<ModelTreeChildElementCreationInfo>();

            foreach (DomainRole r in domainClass.RolesPlayed)
            {
                if (r.Relationship is EmbeddingRelationship && r.Relationship.Source == r && r.Relationship.InheritanceModifier != InheritanceModifier.Abstract)
                {
                    EmbeddingRelationship emb = r.Relationship as EmbeddingRelationship;

                    ModelTreeChildElementCreationInfo info = new ModelTreeChildElementCreationInfo();
                    List<AttributedDomainElement> classes = new List<AttributedDomainElement>();
                    info.Role = r.Opposite;
                    info.TargetElements = new List<AttributedDomainElement>();

                    if (emb.Target.RolePlayer.InheritanceModifier != InheritanceModifier.Abstract)
                        classes.Add(emb.Target.RolePlayer);

                    connections.Add(emb.Target.Name, info);

                    // include derived classes o the child side
                    AttributedDomainElement child = emb.Target.RolePlayer;
                    classes.AddRange(GetNonAbstractDerivedElements(child));

                    // sort by inheritance
                    info.TargetElements.AddRange(SortDomainClassesByInheritance(classes));
                }
            }

            foreach (string key in connections.Keys)
                connectionsRet.Add(connections[key]);

            return connectionsRet;
        }