///--------------------------------------------------------------------------------
        /// <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 RelationshipViewModel PasteRelationship(RelationshipViewModel copyItem, bool savePaste = true)
        {
            Relationship newItem = new Relationship();

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

            newItem.Entity   = Entity;
            newItem.Solution = Solution;
            RelationshipViewModel newView = new RelationshipViewModel(newItem, Solution);

            newView.ResetModified(true);
            AddRelationship(newView);

            // paste children
            foreach (RelationshipPropertyViewModel childView in copyItem.RelationshipProperties)
            {
                newView.PasteRelationshipProperty(childView, savePaste);
            }
            if (savePaste == true)
            {
                Solution.RelationshipList.Add(newItem);
                Entity.RelationshipList.Add(newItem);
                newView.OnUpdated(this, null);
                Solution.ResetModified(true);
            }
            return(newView);
        }
 ///--------------------------------------------------------------------------------
 /// <summary>This method loads Relationships into the view model.</summary>
 ///
 /// <param name="entity">The entity to load.</param>
 /// <param name="solution">The associated solution.</param>
 /// <param name="loadChildren">Flag indicating whether to perform a deeper load.</param>
 ///--------------------------------------------------------------------------------
 public void LoadRelationships(Entity entity, Solution solution, bool loadChildren = true)
 {
     // attach the items
     Items.Clear();
     if (Relationships == null)
     {
         Relationships = new EnterpriseDataObjectList <RelationshipViewModel>();
     }
     if (loadChildren == true)
     {
         foreach (Relationship item in entity.RelationshipList)
         {
             RelationshipViewModel itemView = new RelationshipViewModel(item, solution);
             itemView.Updated += new EventHandler(Children_Updated);
             Relationships.Add(itemView);
             Items.Add(itemView);
         }
     }
 }
 ///--------------------------------------------------------------------------------
 /// <summary>This method applies relationship updates.</summary>
 ///--------------------------------------------------------------------------------
 public void ProcessEditRelationshipPerformed(RelationshipEventArgs data)
 {
     try
     {
         bool isItemMatch = false;
         if (data != null && data.Relationship != null)
         {
             foreach (RelationshipViewModel item in Relationships)
             {
                 if (item.Relationship.RelationshipID == data.Relationship.RelationshipID)
                 {
                     isItemMatch = true;
                     item.Relationship.TransformDataFromObject(data.Relationship, null, false);
                     item.OnUpdated(item, null);
                     item.ShowInTreeView();
                     break;
                 }
             }
             if (isItemMatch == false)
             {
                 // add new Relationship
                 data.Relationship.Entity = Entity;
                 RelationshipViewModel newItem = new RelationshipViewModel(data.Relationship, Solution);
                 newItem.Updated += new EventHandler(Children_Updated);
                 Relationships.Add(newItem);
                 Entity.RelationshipList.Add(newItem.Relationship);
                 Solution.RelationshipList.Add(newItem.Relationship);
                 Items.Add(newItem);
                 OnUpdated(this, null);
                 newItem.ShowInTreeView();
             }
         }
     }
     catch (Exception ex)
     {
         ShowIssue(ex.Message + ex.StackTrace);
     }
 }
 ///--------------------------------------------------------------------------------
 /// <summary>This method deletes an instance of Relationship from the view model.</summary>
 ///
 /// <param name="itemView">The Relationship to delete.</param>
 ///--------------------------------------------------------------------------------
 public void DeleteRelationship(RelationshipViewModel itemView)
 {
     itemView.Updated -= Children_Updated;
     Relationships.Remove(itemView);
     Delete(itemView);
 }
 ///--------------------------------------------------------------------------------
 /// <summary>This method adds an instance of Relationship to the view model.</summary>
 ///
 /// <param name="itemView">The Relationship to add.</param>
 ///--------------------------------------------------------------------------------
 public void AddRelationship(RelationshipViewModel itemView)
 {
     itemView.Updated += new EventHandler(Children_Updated);
     Relationships.Add(itemView);
     Add(itemView);
 }