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

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

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

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

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

            OnPropertyChanged("HasImportedDCCItems");
        }