/// <summary>
        /// Called to handle the "edit" action.
        /// </summary>
        /// <param name="items">A list of items to edit.</param>
        /// <param name="editedItems">The list of items that were edited.</param>
        /// <returns>True if items were edited, false otherwise.</returns>
        protected override bool EditItems(IList <ContactPersonDetail> items, out IList <ContactPersonDetail> editedItems)
        {
            editedItems = new List <ContactPersonDetail>();
            ContactPersonDetail oldItem = CollectionUtils.FirstElement(items);
            ContactPersonDetail newItem = (ContactPersonDetail)oldItem.Clone();

            ContactPersonEditorComponent editor   = new ContactPersonEditorComponent(newItem, _contactTypeChoices, _contactRelationshipChoices);
            ApplicationComponentExitCode exitCode = LaunchAsDialog(this.Host.DesktopWindow, editor, SR.TitleUpdateContactPerson);

            if (exitCode == ApplicationComponentExitCode.Accepted)
            {
                editedItems.Add(newItem);

                // Since there is no way to use IsSameItem to identify the address before and after are the same
                // We must manually remove the old and add the new item
                this.Table.Items.Replace(
                    delegate(ContactPersonDetail x) { return(IsSameItem(oldItem, x)); },
                    newItem);

                // Preserve the order of the items
                int index = _contactPersonList.IndexOf(oldItem);
                _contactPersonList.Insert(index, newItem);
                _contactPersonList.Remove(oldItem);

                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Called to handle the "add" action.
        /// </summary>
        /// <param name="addedItems"></param>
        /// <returns>True if items were added, false otherwise.</returns>
        protected override bool AddItems(out IList <ContactPersonDetail> addedItems)
        {
            addedItems = new List <ContactPersonDetail>();

            ContactPersonDetail contactPerson = new ContactPersonDetail();

            ContactPersonEditorComponent editor   = new ContactPersonEditorComponent(contactPerson, _contactTypeChoices, _contactRelationshipChoices);
            ApplicationComponentExitCode exitCode = LaunchAsDialog(this.Host.DesktopWindow, editor, SR.TitleAddContactPerson);

            if (exitCode == ApplicationComponentExitCode.Accepted)
            {
                addedItems.Add(contactPerson);
                _contactPersonList.Add(contactPerson);
                return(true);
            }

            return(false);
        }