///--------------------------------------------------------------------------------
        /// <summary>This method processes the new entityreference command.</summary>
        ///--------------------------------------------------------------------------------
        public void ProcessNewEntityReferenceCommand()
        {
            EntityReferenceEventArgs message = new EntityReferenceEventArgs();

            message.EntityReference            = new EntityReference();
            message.EntityReference.PropertyID = Guid.NewGuid();
            message.EntityReference.EntityID   = Entity.EntityID;
            message.EntityReference.Entity     = Entity;
            message.EntityID = Entity.EntityID;
            message.EntityReference.Solution = Solution;
            message.Solution = Solution;
            if (message.EntityReference.Entity != null)
            {
                message.EntityReference.Order = message.EntityReference.Entity.EntityReferenceList.Count + 1;
            }
            message.WorkspaceID = WorkspaceID;
            Mediator.NotifyColleagues <EntityReferenceEventArgs>(MediatorMessages.Command_EditEntityReferenceRequested, message);
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method applies entityreference deletes.</summary>
        ///--------------------------------------------------------------------------------
        public void ProcessDeleteEntityReferencePerformed(EntityReferenceEventArgs data)
        {
            try
            {
                bool isItemMatch = false;
                if (data != null && data.EntityReference != null)
                {
                    foreach (EntityReferenceViewModel item in EntityReferences.ToList <EntityReferenceViewModel>())
                    {
                        if (item.EntityReference.PropertyID == data.EntityReference.PropertyID)
                        {
                            // remove item from tabs, if present
                            WorkspaceEventArgs message = new WorkspaceEventArgs();
                            message.ItemID = item.EntityReference.PropertyID;
                            Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message);

                            // delete children
                            for (int i = item.Items.Count - 1; i >= 0; i--)
                            {
                            }

                            // delete item
                            isItemMatch = true;
                            EntityReferences.Remove(item);
                            Entity.EntityReferenceList.Remove(item.EntityReference);
                            Items.Remove(item);
                            Entity.ResetModified(true);
                            OnUpdated(this, null);
                            break;
                        }
                    }
                    if (isItemMatch == false)
                    {
                        ShowIssue(DisplayValues.Issue_DeleteItemNotFound);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowIssue(ex.Message + ex.StackTrace);
            }
        }
 ///--------------------------------------------------------------------------------
 /// <summary>This method applies entityreference updates.</summary>
 ///--------------------------------------------------------------------------------
 public void ProcessEditEntityReferencePerformed(EntityReferenceEventArgs data)
 {
     try
     {
         bool isItemMatch = false;
         if (data != null && data.EntityReference != null)
         {
             foreach (EntityReferenceViewModel item in EntityReferences)
             {
                 if (item.EntityReference.PropertyID == data.EntityReference.PropertyID)
                 {
                     isItemMatch = true;
                     item.EntityReference.TransformDataFromObject(data.EntityReference, null, false);
                     item.OnUpdated(item, null);
                     item.ShowInTreeView();
                     break;
                 }
             }
             if (isItemMatch == false)
             {
                 // add new EntityReference
                 data.EntityReference.Entity = Entity;
                 EntityReferenceViewModel newItem = new EntityReferenceViewModel(data.EntityReference, Solution);
                 newItem.Updated += new EventHandler(Children_Updated);
                 EntityReferences.Add(newItem);
                 Entity.EntityReferenceList.Add(newItem.EntityReference);
                 Solution.EntityReferenceList.Add(newItem.EntityReference);
                 Items.Add(newItem);
                 OnUpdated(this, null);
                 newItem.ShowInTreeView();
             }
         }
     }
     catch (Exception ex)
     {
         ShowIssue(ex.Message + ex.StackTrace);
     }
 }