/// <summary>
        /// Clean up.
        /// </summary>
        protected override void OnDispose()
        {
            if (this.ShapeElement != null)
            {
                Unsubscribe();
            }

            for (int i = this.nestedChildItems.Count - 1; i >= 0; i--)
            {
                BaseDiagramItemElementViewModel vm = nestedChildItems[i];
                this.RemoveNestedChild(vm);
                vm.Dispose();
            }


            for (int i = this.relativeChildItems.Count - 1; i >= 0; i--)
            {
                BaseDiagramItemElementViewModel vm = relativeChildItems[i];
                this.RemoveRelativeChild(vm);
                vm.Dispose();
            }

            this.ShapeElement = null;
            this.parentItem   = null;

            base.OnDispose();
        }
        /// <summary>
        /// Called whenever a relationship of type NodeShapeReferencesRelativeChildren is removed and
        /// the element hosted by this model is the source.
        /// </summary>
        /// <param name="args"></param>
        protected virtual void OnRelativeChildShapeElementRemoved(ElementDeletedEventArgs args)
        {
            NodeShapeReferencesRelativeChildren con = args.ModelElement as NodeShapeReferencesRelativeChildren;
            NodeShape nodeShape = con.ChildShape;

            if (nodeShape != null)
            {
                for (int i = this.relativeChildItems.Count - 1; i >= 0; i--)
                {
                    if (this.relativeChildItems[i].ShapeElement.Id == nodeShape.Id)
                    {
                        BaseDiagramItemElementViewModel vm = this.relativeChildItems[i];
                        this.RemoveRelativeChild(vm);
                        vm.Dispose();
                    }
                }
            }
        }