/// <summary>
        /// Reconciles the mapping bag2.
        /// </summary>
        /// <param name="mSourceField">The m source field.</param>
        private void ReconcileMappingBag2(MOriginalField mSourceField)
        {
            var bag = Mappings;

            if (mSourceField != null && mSourceField.TargetField != null && !mSourceField.RemoveMapping)
            {
                bag[mSourceField.TargetField.Name] = mSourceField.Name;
            }
            else if (mSourceField != null && mSourceField.TargetField != null && mSourceField.RemoveMapping)
            {
                if (mSourceField.RemoveMapping)
                {
                    if (!string.IsNullOrEmpty(Mappings[mSourceField.TargetField.Name]))
                    {
                        Mappings.Remove(mSourceField.TargetField.Name);
                    }

                    mSourceField.TargetField = null;
                    SourceFields.CommitEdit();
                    SourceFields.Refresh();

                    UpdateMappedFieldsCount();
                }
            }
        }
 // Save or undo mappings made in the popup dialog depending on the user clicking Ok or Cancel
 /// <summary>
 /// Updates the mapping.
 /// </summary>
 /// <param name="parameter">The parameter.</param>
 private void UpdateMapping(object parameter)
 {
     if (parameter.ToString() == "Save")
     {
     }
     else if (parameter.ToString() == "Cancel")
     {
         if (SelectedTargetField.MappedField == null)
         {
             SelectedOriginalField = null;
         }
         else
         {
             SelectedOriginalField = SelectedTargetField.MappedField;
         }
     }
 }
        /// <summary>
        /// Executes the remove mapping.
        /// </summary>
        /// <param name="mappedField">The mapped field.</param>
        public void ExecuteRemoveMapping(MOriginalField mappedField)
        {
            if (mappedField == null)
            {
                return;
            }

            mappedField.RemoveMapping = true; // If set to false and the TargetField property is still mapped then triggers functionality to finsh unmapping.

            if (mappedField.IsAutoMapped)
            {
                mappedField.IsAutoMapped = false;
            }

            var target = mappedField.TargetField;

            if (target == null)
            {
                return;
            }

            if (target.IsRequired)
            {
                RequiredTargetFields.AddNewItem(target);
                RequiredTargetFields.CommitNew();
                RequiredTargetFields.Refresh();

                TargetFieldsTabIndex = 0;
            }
            else
            {
                OptionalTargetFields.AddNewItem(target);
                OptionalTargetFields.CommitNew();
                OptionalTargetFields.Refresh();

                TargetFieldsTabIndex = 1;
            }

            mappedField.OnMappingChanged(EventArgs.Empty);

            mappedField.RemoveMapping = false;

            UpdateMappedFieldsCount();
        }