/**
  * @param EntityDocument $entity
  *
  * @return EntityDocument
  */
 private function clearEntity(EntityDocument $entity)
 {
     $newEntity = $this->entityFactory->newEmpty($entity->getType());
     $newEntity->setId($entity->getId());
     // FIXME how to avoid special case handling here?
     if ($entity instanceof Property) {
         /** @var Property $newEntity */
         $newEntity->setDataTypeId($entity->getDataTypeId());
     }
     return $newEntity;
 }