/// <summary>
        ///     Remove a relationship end
        /// </summary>
        /// <param name="end"> the end to remove </param>
        /// <returns> true if item was in list </returns>
        public bool Remove(IRelationshipEnd end)
        {
            DebugCheck.NotNull(end);

            if (!IsEndValid(end))
            {
                return(false);
            }

            KeysInDefOrder.Remove(end.Name);
            var wasInList = EndLookup.Remove(end.Name);

            return(wasInList);
        }
        /// <summary>
        /// Remove a relationship end
        /// </summary>
        /// <param name="end">the end to remove</param>
        /// <returns>true if item was in list</returns>
        public bool Remove(IRelationshipEnd end)
        {
            Debug.Assert(end != null, "end parameter is null");

            if (!IsEndValid(end))
            {
                return(false);
            }

            KeysInDefOrder.Remove(end.Name);
            bool wasInList = EndLookup.Remove(end.Name);

            return(wasInList);
        }
        /// <summary>
        ///     Add a relationship end
        /// </summary>
        /// <param name="end"> the end to add </param>
        public void Add(IRelationshipEnd end)
        {
            DebugCheck.NotNull(end);

            var endElement = end as SchemaElement;

            Debug.Assert(endElement != null, "end is not a SchemaElement");

            // this should have been caught before this, just ignore it
            if (!IsEndValid(end))
            {
                return;
            }

            if (!ValidateUniqueName(endElement, end.Name))
            {
                return;
            }

            EndLookup.Add(end.Name, end);
            KeysInDefOrder.Add(end.Name);
        }