///--------------------------------------------------------------------------------
        /// <summary>This method applies relationship deletes.</summary>
        ///--------------------------------------------------------------------------------
        public void ProcessDeleteRelationshipPerformed(RelationshipEventArgs data)
        {
            try
            {
                bool isItemMatch = false;
                if (data != null && data.Relationship != null)
                {
                    foreach (RelationshipViewModel item in Relationships.ToList <RelationshipViewModel>())
                    {
                        if (item.Relationship.RelationshipID == data.Relationship.RelationshipID)
                        {
                            // remove item from tabs, if present
                            WorkspaceEventArgs message = new WorkspaceEventArgs();
                            message.ItemID = item.Relationship.RelationshipID;
                            Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message);

                            // delete children
                            for (int i = item.Items.Count - 1; i >= 0; i--)
                            {
                                if (item.Items[i] is RelationshipPropertyViewModel)
                                {
                                    RelationshipPropertyViewModel child        = item.Items[i] as RelationshipPropertyViewModel;
                                    RelationshipPropertyEventArgs childMessage = new RelationshipPropertyEventArgs();
                                    childMessage.RelationshipProperty = child.RelationshipProperty;
                                    childMessage.RelationshipID       = item.Relationship.RelationshipID;
                                    childMessage.Solution             = Solution;
                                    childMessage.WorkspaceID          = child.WorkspaceID;
                                    item.ProcessDeleteRelationshipPropertyPerformed(childMessage);
                                }
                            }

                            // delete item
                            isItemMatch = true;
                            Relationships.Remove(item);
                            Entity.RelationshipList.Remove(item.Relationship);
                            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 is used to copy/paste a new item.</summary>
        ///
        /// <param name="copyItem">The item to copy/paste.</param>
        /// <param name="savePaste">Flag to determine whether to save the results of the paste.</param>
        ///--------------------------------------------------------------------------------
        public RelationshipPropertyViewModel PasteRelationshipProperty(RelationshipPropertyViewModel copyItem, bool savePaste = true)
        {
            RelationshipProperty newItem = new RelationshipProperty();

            newItem.ReverseInstance = new RelationshipProperty();
            newItem.TransformDataFromObject(copyItem.RelationshipProperty, null, false);
            newItem.RelationshipPropertyID = Guid.NewGuid();
            newItem.IsAutoUpdated          = false;

            // try to find Property by existing id first, second by old id, finally by name
            newItem.Property = Relationship.Entity.PropertyList.FindByID((Guid)copyItem.RelationshipProperty.PropertyID);
            if (newItem.Property == null && Solution.PasteNewGuids[copyItem.RelationshipProperty.PropertyID.ToString()] is Guid)
            {
                newItem.Property = Relationship.Entity.PropertyList.FindByID((Guid)Solution.PasteNewGuids[copyItem.RelationshipProperty.PropertyID.ToString()]);
            }
            if (newItem.Property == null)
            {
                newItem.Property = Relationship.Entity.PropertyList.Find("Name", copyItem.RelationshipProperty.PropertyName);
            }
            if (newItem.Property == null)
            {
                newItem.OldPropertyID = newItem.PropertyID;
                newItem.PropertyID    = Guid.Empty;
            }

            // try to find Property by existing id first, second by old id, finally by name
            newItem.ReferencedProperty = Relationship.Entity.PropertyList.FindByID((Guid)copyItem.RelationshipProperty.ReferencedPropertyID);
            if (Relationship.ReferencedEntity == null)
            {
                Relationship.ReferencedEntity = Solution.EntityList.FindByID(Relationship.ReferencedEntityID);
            }
            if (Relationship.ReferencedEntity == null && copyItem.RelationshipProperty.Relationship.ReferencedEntity != null)
            {
                Feature feature = Solution.FeatureList.Find(f => f.FeatureName == copyItem.RelationshipProperty.Relationship.ReferencedEntity.FeatureName);
                if (feature != null)
                {
                    Relationship.ReferencedEntity = feature.EntityList.Find(e => e.EntityName == copyItem.RelationshipProperty.Relationship.ReferencedEntity.EntityName);
                }
                else
                {
                    Relationship.ReferencedEntity = Solution.EntityList.Find(e => e.EntityName == copyItem.RelationshipProperty.Relationship.ReferencedEntity.EntityName);
                }
            }
            if (Relationship.ReferencedEntity != null)
            {
                if (newItem.ReferencedProperty == null && Solution.PasteNewGuids[copyItem.RelationshipProperty.ReferencedPropertyID.ToString()] is Guid)
                {
                    newItem.ReferencedProperty = Relationship.ReferencedEntity.PropertyList.FindByID((Guid)Solution.PasteNewGuids[copyItem.RelationshipProperty.ReferencedPropertyID.ToString()]);
                }
                if (newItem.ReferencedProperty == null)
                {
                    newItem.ReferencedProperty = Relationship.ReferencedEntity.PropertyList.Find("Name", copyItem.RelationshipProperty.ReferencedPropertyName);
                }
                if (newItem.ReferencedProperty == null && copyItem.RelationshipProperty.ReferencedProperty != null)
                {
                    newItem.ReferencedProperty = Relationship.ReferencedEntity.PropertyList.Find(p => p.PropertyName == copyItem.RelationshipProperty.ReferencedProperty.PropertyName);
                }
            }
            if (newItem.ReferencedProperty == null)
            {
                newItem.OldReferencedPropertyID = newItem.ReferencedPropertyID;
                newItem.ReferencedPropertyID    = Guid.Empty;
            }
            newItem.Relationship = Relationship;
            newItem.Solution     = Solution;
            RelationshipPropertyViewModel newView = new RelationshipPropertyViewModel(newItem, Solution);

            newView.ResetModified(true);
            AddRelationshipProperty(newView);
            if (savePaste == true)
            {
                Solution.RelationshipPropertyList.Add(newItem);
                Relationship.RelationshipPropertyList.Add(newItem);
                newView.OnUpdated(this, null);
                Solution.ResetModified(true);
            }
            return(newView);
        }