this and the previous is copied from the CollectionResolver.