/**
  * Transform the object to be indexed by Elasticsearch
  *
  * @param ContentInterface $content
  *
  * @return Document
  */
 public function transform($content)
 {
     $keywords = array();
     foreach ($content->getKeywords() as $keyword) {
         $keywords[] = $keyword->getLabel();
     }
     $documentData = array('id' => $content->getContentId() . '-' . $content->getLanguage(), 'elementId' => $content->getId(), 'contentId' => $content->getContentId(), 'name' => $content->getName(), 'siteId' => $content->getSiteId(), 'linkedToSite' => $content->isLinkedToSite(), 'language' => $content->getLanguage(), 'contentType' => $content->getContentType(), 'keywords' => implode(',', $keywords), 'updatedAt' => $content->getUpdatedAt()->getTimestamp());
     /** @var ContentAttributeInterface $attribute */
     foreach ($content->getAttributes() as $attribute) {
         if (null !== $attribute->getValue() && '' !== $attribute->getValue()) {
             $documentData['attribute_' . $attribute->getName()] = $attribute->getValue();
             $documentData['attribute_' . $attribute->getName() . '_stringValue'] = $attribute->getStringValue();
         }
     }
     return new Document($documentData['id'], $documentData);
 }
 /**
  * @param ContentInterface $content
  *
  * @return ContentInterface
  */
 protected function cloneContent(ContentInterface $content)
 {
     $newContent = clone $content;
     $newContent->setCurrentlyPublished(false);
     $newContent->setStatus(null);
     foreach ($content->getKeywords() as $keyword) {
         $newContent->addKeyword($keyword);
     }
     foreach ($content->getAttributes() as $attribute) {
         $newAttribute = clone $attribute;
         $newContent->addAttribute($newAttribute);
     }
     return $newContent;
 }