public override Microsoft.VisualStudio.Modeling.ModelElement GetHostedElement()
        {
            if (this.IsDisposed)
            {
                return(null);
            }

            return(DesignerDiagramClassReferencesIncludedDiagramClasses.GetLink(ParentDesignerClass, this.Element as DiagramClass));
        }
        /// <summary>
        /// Called whenever a relationship of type DesignerDiagramClassReferencesIncludedDiagramClasses is deleted and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnIncludedDDCRemoved(ElementDeletedEventArgs args)
        {
            DesignerDiagramClassReferencesIncludedDiagramClasses con = args.ModelElement as DesignerDiagramClassReferencesIncludedDiagramClasses;

            if (con != null)
            {
                DeleteIncludedDDC(con);
            }
        }
        /// <summary>
        /// Called whenever a relationship of type DesignerDiagramClassReferencesTargetDesignerDiagramClasses is added and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        private void OnIncludedDDCAdded(ElementAddedEventArgs args)
        {
            DesignerDiagramClassReferencesIncludedDiagramClasses con = args.ModelElement as DesignerDiagramClassReferencesIncludedDiagramClasses;

            if (con != null)
            {
                AddIncludedDDC(con.DiagramClass);
            }
        }
        /// <summary>
        /// Deletes the view model that is hosting the given node.
        /// </summary>
        /// <param name="node">Node.</param>
        public void DeleteIncludedDDC(DesignerDiagramClassReferencesIncludedDiagramClasses node)
        {
            for (int i = this.includedDCVMs.Count - 1; i >= 0; i--)
            {
                if (this.includedDCVMs[i].LinkId == node.Id)
                {
                    this.includedDCVMs[i].Dispose();
                    this.includedDCVMs.RemoveAt(i);
                    break;
                }
            }

            OnPropertyChanged("HasIncludedDCItems");
        }
        /// <summary>
        /// Deletes the view model that is hosting the given node.
        /// </summary>
        /// <param name="node">Node.</param>
        public void DeleteIncludedDDC(DesignerDiagramClassReferencesIncludedDiagramClasses node)
        {
            for (int i = this.includedDCVMs.Count - 1; i >= 0; i--)
                if (this.includedDCVMs[i].LinkId == node.Id)
                {
                    this.includedDCVMs[i].Dispose();
                    this.includedDCVMs.RemoveAt(i);
                    break;
                }

            OnPropertyChanged("HasIncludedDCItems");
        }