private function saveTranslatedValue(PersistentObject $object, $valueName, $existingTranslation, $lang) {
    $mapper = $object->getMapper();
    $isTranslatable = $mapper != null && $mapper->hasAttribute($valueName) ? $mapper->getAttribute($valueName)->hasTag('TRANSLATABLE') : false;
    if ($isTranslatable) {
      $value = $object->getValue($valueName);
      $translation = $existingTranslation;
      $valueIsEmpty = $value === null || $value === '';

      // if no translation exists and the value is not empty, create a new translation
      if ($translation == null && !$valueIsEmpty) {
        $translation = $this->persistenceFacade->create($this->translationType);
      }

      // if a translation exists and the value is empty, remove the existing translation
      if ($translation != null && $valueIsEmpty) {
        $translation->delete();
        $translation = null;
      }

      if ($translation) {
        // set all required properties
        $oid = $object->getOID()->__toString();
        $translation->setValue('objectid', $oid);
        $translation->setValue('attribute', $valueName);
        $translation->setValue('translation', $value);
        $translation->setValue('language', $lang);

        // store translation for oid update if necessary (see afterCreate())
        if (!isset($this->createdTranslations[$oid])) {
          $this->createdTranslations[$oid] = [];
        }
        $this->createdTranslations[$oid][] = $translation;
      }
    }
  }