private void AssertCollectionsAreEquivalent()
 {
     if (this._sourceCollection.Count != this._descriptionCollection.Count)
     {
         // Collections may not be equivalent if a descriptor isn't fully defined
         return;
     }
     Debug.Assert(GroupCollectionManager.AreEquivalent(this._descriptionCollection, this._sourceCollection), "Collections should be equal.");
 }
        /// <summary>
        /// Determines whether the <paramref name="groupDescriptions"/> are equivalent to the <paramref name="groupDescriptors"/>.
        /// </summary>
        /// <param name="groupDescriptions">The descriptions to compare</param>
        /// <param name="groupDescriptors">The descriptors to compare</param>
        /// <returns><c>true</c> if the collections are equivalent</returns>
        private static bool AreEquivalent(ObservableCollection <GroupDescription> groupDescriptions, GroupDescriptorCollection groupDescriptors)
        {
            Debug.Assert((groupDescriptions != null) && (groupDescriptors != null), "Both should be non-null.");

            if (groupDescriptions.Count != groupDescriptors.Count)
            {
                return(false);
            }

            for (int i = 0, count = groupDescriptions.Count; i < count; i++)
            {
                if (!GroupCollectionManager.AreEquivalent(groupDescriptions[i], groupDescriptors[i]))
                {
                    return(false);
                }
            }

            return(true);
        }