public override void VisitCollection(IEnumerable collection, CollectionDescriptor descriptor)
 {
     CollectionItemIdentifiers itemIds;
     if (inNonIdentifiableType == 0 && !CollectionItemIdHelper.TryGetCollectionItemIds(collection, out itemIds))
     {
         itemIds = CollectionItemIdHelper.GetCollectionItemIds(collection);
         var count = descriptor.GetCollectionCount(collection);
         for (var i = 0; i < count; ++i)
         {
             itemIds.Add(i, ItemId.New());
         }
     }
     base.VisitCollection(collection, descriptor);
 }
        /// <inheritdoc/>
        public override void VisitCollection(IEnumerable collection, CollectionDescriptor descriptor)
        {
            var containerNode = GetContextNode();

            var count = descriptor.GetCollectionCount(collection);
            var referenceInfo = GetReferenceInfo(descriptor.Type, collection);

            if (referenceInfo != null && referenceInfo.EnumerableCount != count)
                throw new QuantumConsistencyException("A node with an EnumerableReference containing [{0}] items", referenceInfo.EnumerableCount.ToStringSafe(), "A node with an EnumerableReference containing [{0}] items", count.ToStringSafe(), containerNode);

            if (IsPrimitiveType(descriptor.ElementType, false) || IsEnumerable(descriptor.ElementType))
            {
                base.VisitCollection(collection, descriptor);
            }
        }