/// <summary>
        /// Performs the business logic for adding the Parent relationship between the person and the parents.
        /// </summary>
        public static void AddParent(PeopleCollection family, Person person, ParentSet parentSet)
        {
            // First add child to parents.
            family.AddChild(parentSet.FirstParent, person, ParentChildModifier.Natural);
            family.AddChild(parentSet.SecondParent, person, ParentChildModifier.Natural);

            // Next update the siblings. Get the list of full siblings for the person. A full sibling
            // is a sibling that has both parents in common.
            List <Person> siblings = GetChildren(parentSet);

            foreach (Person sibling in siblings)
            {
                if (sibling != person)
                {
                    family.AddSibling(person, sibling);
                }
            }
        }
        /// <summary>
        /// Performs the business logic for adding the Sibling relationship between the person and
        /// the sibling.
        /// </summary>
        public static void AddSibling(PeopleCollection family, Person person, Person sibling)
        {
            // Handle siblings
            if (person.Siblings.Count > 0)
            {
                // Make the siblings siblings to each other.
                foreach (Person existingSibling in person.Siblings)
                {
                    family.AddSibling(existingSibling, sibling);
                }
            }

            if (person.Parents != null)
            {
                switch (person.Parents.Count)
                {
                // No parents
                case 0:
                    family.AddSibling(person, sibling);
                    break;

                // Single parent
                case 1:
                    family.AddSibling(person, sibling);
                    family.AddChild(person.Parents[0], sibling, ParentChildModifier.Natural);
                    break;

                // 2 parents
                case 2:
                    // Add the sibling as a child of the same parents
                    foreach (Person parent in person.Parents)
                    {
                        family.AddChild(parent, sibling, ParentChildModifier.Natural);
                    }

                    family.AddSibling(person, sibling);
                    break;

                default:
                    family.AddSibling(person, sibling);
                    break;
                }
            }
        }
        /// <summary>
        /// Performs the business logic for adding the Spousal relationship between the person and
        /// the spouse.
        /// </summary>
        public static void AddSpouse(PeopleCollection family, Person person, Person spouse, SpouseModifier modifier)
        {
            // Assume the spouse's gender based on the counterpart of the person's gender
            if (person.Gender == Gender.Male)
            {
                spouse.Gender = Gender.Female;
            }
            else
            {
                spouse.Gender = Gender.Male;
            }

            if (person.Spouses != null)
            {
                switch (person.Spouses.Count)
                {
                // No existing spouse
                case 0:
                    family.AddSpouse(person, spouse, modifier);

                    // Add any of the children as the child of the spouse.
                    if (person.Children != null || person.Children.Count > 0)
                    {
                        foreach (Person child in person.Children)
                        {
                            family.AddChild(spouse, child, ParentChildModifier.Natural);
                        }
                    }
                    break;

                // Existing spouse(s)
                default:
                    // If specifying a new married spouse, make existing spouses former.
                    if (modifier == SpouseModifier.Current)
                    {
                        foreach (Relationship relationship in person.Relationships)
                        {
                            if (relationship.RelationshipType == RelationshipType.Spouse)
                            {
                                ((SpouseRelationship)relationship).SpouseModifier = SpouseModifier.Former;
                            }
                        }
                    }

                    family.AddSpouse(person, spouse, modifier);
                    break;
                }

                // Setter for property change notification
                person.HasSpouse = true;
            }
        }
        /// <summary>
        /// Performs the business logic for adding the Child relationship between the person and the child.
        /// </summary>
        public static void AddChild(PeopleCollection family, Person person, Person child)
        {
            // Add the new child as a sibling to any existing children
            foreach (Person existingSibling in person.Children)
            {
                family.AddSibling(existingSibling, child);
            }

            switch (person.Spouses.Count)
            {
            // Single parent, add the child to the person
            case 0:
                family.AddChild(person, child, ParentChildModifier.Natural);
                break;

            // Has existing spouse, add the child to the person's spouse as well.
            case 1:
                family.AddChild(person, child, ParentChildModifier.Natural);
                family.AddChild(person.Spouses[0], child, ParentChildModifier.Natural);
                break;
            }
        }
        /// <summary>
        /// Performs the business logic for adding the Parent relationship between the person and the parent.
        /// </summary>
        public static void AddParent(PeopleCollection family, Person person, Person parent)
        {
            // A person can only have 2 parents, do nothing
            if (person.Parents.Count == 2)
            {
                return;
            }

            // Add the parent to the main collection of people.
            family.Add(parent);

            switch (person.Parents.Count)
            {
            // No exisitng parents
            case 0:
                family.AddChild(parent, person, ParentChildModifier.Natural);
                break;

            // An existing parent
            case 1:
                family.AddChild(parent, person, ParentChildModifier.Natural);
                family.AddSpouse(parent, person.Parents[0], SpouseModifier.Current);
                break;
            }

            // Handle siblings
            if (person.Siblings.Count > 0)
            {
                // Make siblings the child of the new parent
                foreach (Person sibling in person.Siblings)
                {
                    family.AddChild(parent, sibling, ParentChildModifier.Natural);
                }
            }

            // Setter for property change notification
            person.HasParents = true;
        }