/**
  * Adds a property with propertyId as index. Existing property with same id will be replaced.
  *
  * @param PropertyDataInterface $property the property
  */
 public function addProperty(PropertyDataInterface $property)
 {
     $this->properties[$property->getId()] = $property;
 }
 /**
  * Convert PropertyData into a property API object
  *
  * @param ObjectTypeInterface $objectType
  * @param SecondaryTypeInterface[] $secondaryTypes
  * @param PropertyDataInterface $propertyData
  * @return PropertyInterface
  * @throws CmisRuntimeException
  */
 protected function convertProperty(ObjectTypeInterface $objectType, array $secondaryTypes, PropertyDataInterface $propertyData)
 {
     $definition = $objectType->getPropertyDefinition($propertyData->getId());
     // search secondary types
     if ($definition === null && !empty($secondaryTypes)) {
         foreach ($secondaryTypes as $secondaryType) {
             $propertyDefinitions = $secondaryType->getPropertyDefinitions();
             if (!empty($propertyDefinitions)) {
                 $definition = $secondaryType->getPropertyDefinition($propertyData->getId());
                 if ($definition !== null) {
                     break;
                 }
             }
         }
     }
     // the type might have changed -> reload type definitions
     if ($definition === null) {
         $reloadedObjectType = $this->session->getTypeDefinition($objectType->getId(), false);
         $definition = $reloadedObjectType->getPropertyDefinition($propertyData->getId());
         if ($definition === null && !empty($secondaryTypes)) {
             foreach ($secondaryTypes as $secondaryType) {
                 $reloadedSecondaryType = $this->session->getTypeDefinition($secondaryType->getId(), false);
                 $propertyDefinitions = $reloadedSecondaryType->getPropertyDefinitions();
                 if (!empty($propertyDefinitions)) {
                     $definition = $reloadedSecondaryType->getPropertyDefinition($propertyData->getId());
                     if ($definition !== null) {
                         break;
                     }
                 }
             }
         }
     }
     if ($definition === null) {
         // property without definition
         throw new CmisRuntimeException(sprintf('Property "%s" doesn\'t exist!', $propertyData->getId()));
     }
     return $this->createProperty($definition, $propertyData->getValues());
 }