internal static ICollection GetLoadedElementsCollection(PersistentCollectionType collectionType, object collection)
 {
     if (CollectionIsInitialized(collection))
     {
         // handles arrays and newly instantiated collections
         return(collectionType.GetElementsCollection(collection));
     }
     else
     {
         // does not handle arrays (that's ok, cos they can't be lazy)
         // or newly instantiated collections so we can do the cast
         return(((PersistentCollection)collection).QueuedAddsCollection);
     }
 }
 internal static ICollection GetAllElementsCollection(PersistentCollectionType collectionType, object collection)
 {
     return(collectionType.GetElementsCollection(collection));
 }