/// <summary>
        /// Inserts the element passed in as a sibling to the element the navigator is currently on.
        /// The navigator will move to the inserted element.
        /// </summary>
        /// <param name="sibling"></param>
        /// <returns></returns>
        public override bool InsertAfter(Profile.ElementComponent sibling)
        {
            if (!canInsertSiblingHere())
            {
                return(false);
            }

            var insertPosition = positionAfter();
            var newSiblingPath = ParentPath + "." + sibling.GetNameFromPath();

            if (insertPosition == Count) // At last position
            {
                _elements.Add(sibling);
            }
            else
            {
                _elements.Insert(insertPosition, sibling);
            }

            // Adjust the sibling's path so it's parent is the same as the current node
            sibling.Path = newSiblingPath;

            // Navigate to newly inserted node
            OrdinalPosition = insertPosition;

            return(true);
        }
        /// <summary>
        /// Inserts the element passed in as a child of the element the navigator is currently on.
        /// The navigator will move to the inserted element.
        /// </summary>
        /// <param name="sibling"></param>
        /// <returns></returns>
        /// <remarks>You can only insert a child for an element does not have children yet.</remarks>
        public override bool InsertFirstChild(Profile.ElementComponent child)
        {
            if (Count == 0)
            {
                // Special case, insert a new root
                _elements.Add(child);
                child.Path      = child.GetNameFromPath();
                OrdinalPosition = 0;
                return(true);
            }
            else if (HasChildren)
            {
                return(false);       // Cannot insert another child, there's already one.
            }
            else
            {
                var newSiblingPath = Path + "." + child.GetNameFromPath();

                if (OrdinalPosition == Count - 1) // At last position
                {
                    _elements.Add(child);
                }
                else
                {
                    _elements.Insert(OrdinalPosition.Value + 1, child);
                }

                // Set the name to be a true child -> this actually creates a child
                child.Path = newSiblingPath;

                // Navigate to newly inserted child
                OrdinalPosition += 1;

                return(true);
            }
        }
//----------------------------------
//
// Methods that alter the list of elements
//
//----------------------------------

        /// <summary>
        /// Inserts the element passed in as a sibling to the element the navigator is currently on.
        /// The navigator will move to the inserted element.
        /// </summary>
        /// <param name="sibling"></param>
        /// <returns></returns>
        public override bool InsertBefore(Profile.ElementComponent sibling)
        {
            if (!canInsertSiblingHere())
            {
                return(false);
            }

            var newSiblingPath = ParentPath + "." + sibling.GetNameFromPath();

            _elements.Insert(OrdinalPosition.Value, sibling);

            // Adjust the sibling's path so it's parent is the same as the current node
            sibling.Path = newSiblingPath;

            // Note: we're now positioned on the newly inserted element

            return(true);
        }