/**
  * Retrieve the complex type(s) used in the given resource type and cache them.
  * 
  * @param ResourceType $resourceType The resource type to inspect
  * 
  * @return void
  * 
  * @throws InvalidOperationException If found any complex type bag property 
  * with derived type(s) 
  */
 private function _populateComplexTypes(ResourceType $resourceType)
 {
     foreach ($resourceType->getPropertiesDeclaredOnThisType() as $property) {
         if ($property->isKindOf(ResourcePropertyKind::COMPLEX_TYPE)) {
             if ($property->isKindOf(ResourcePropertyKind::BAG)) {
                 //Validate the bag complex type
                 //as it should not have derived type
                 if ($this->metadataQueryproviderWrapper->hasDerivedTypes($resourceType)) {
                     throw new InvalidOperationException(Messages::metadataResourceTypeSetBagOfComplexTypeWithDerivedTypes($resourceType->getFullName()));
                 }
             }
             if ($this->_populateResourceTypes($property->getResourceType())) {
                 $this->_populateComplexTypes($property->getResourceType());
             }
         }
     }
 }