/**
  * {@inheritDoc}
  */
 public function transform($object, ContextInterface $context)
 {
     $metadata = $this->metadataFactory->loadMetadata(get_class($object));
     // Get properties for transformation
     if (!$context->getGroups()) {
         $transformProperties = $metadata->getProperties();
     } else {
         $transformProperties = $metadata->getPropertiesForGroups($context->getGroups());
     }
     // Try create transformed
     $transformedClass = $metadata->getTransformedClass();
     $transformedReflection = Reflection::loadClassReflection($transformedClass);
     $transformed = $metadata->isEvaluateConstructor() ? $transformedReflection->newInstance() : $transformedReflection->newInstanceWithoutConstructor();
     foreach ($transformProperties as $transformPropertyName => $propertyMetadata) {
         try {
             $objectPropertyReflection = Reflection::loadPropertyReflection($object, $transformPropertyName);
         } catch (\ReflectionException $e) {
             throw new \RuntimeException(sprintf('Error transform property: Not found property "%s" in class "%s".', $transformPropertyName, get_class($object)), 0, $e);
         }
         try {
             $transformedPropertyReflection = $transformedReflection->getProperty($propertyMetadata->getPropertyName());
         } catch (\ReflectionException $e) {
             throw new \RuntimeException(sprintf('Error transform property: Not found property "%s" in class "%s".', $propertyMetadata->getPropertyName(), $transformedReflection->getName()));
         }
         if (!$transformedPropertyReflection->isPublic()) {
             $transformedPropertyReflection->setAccessible(true);
         }
         if (!$objectPropertyReflection->isPublic()) {
             $objectPropertyReflection->setAccessible(true);
         }
         $objectPropertyValue = $objectPropertyReflection->getValue($object);
         $transformedValue = $this->transformValue($object, $objectPropertyValue, $propertyMetadata, $transformedPropertyReflection);
         $transformedPropertyReflection->setValue($transformed, $transformedValue);
     }
     return $transformed;
 }