/**
  * Updates the resource fields with given data
  *
  * @param array                   $properties
  * @param FieldMetadataCollection $collection
  * @param object                  $resource
  */
 protected function updateEntityFields(array $properties, FieldMetadataCollection $collection, $resource)
 {
     foreach ($properties as $propertyName => $propertyValue) {
         if ($collection->has($propertyName) && is_scalar($propertyValue)) {
             if ($this->propertyAccessor->isWritable($resource, $propertyName)) {
                 $this->propertyAccessor->setValue($resource, $propertyName, $propertyValue);
             }
         }
     }
 }
 /**
  * Checks whether the embeddable field is serializable
  *
  * @param string                  $embeddableName
  * @param FieldMetadataCollection $collection
  *
  * @return bool
  */
 protected function isEmbeddableSerializable($embeddableName, FieldMetadataCollection $collection)
 {
     if ($collection->has($embeddableName)) {
         $embeddable = $collection->get($embeddableName);
         return $embeddable->hasGroup($this->context['group']) || $embeddable->hasDefaultGroup();
     }
     return false;
 }