protected function doLoadDatabaseTranslation($document, ClassMetadata $metadata, $locale, $fallback, $refresh)
    {
        $oid = spl_object_hash($document);

        $strategy = $this->dm->getTranslationStrategy($metadata->translator);

        try {
            $node = $this->session->getNode($this->getDocumentId($oid));
            if ($strategy->loadTranslation($document, $node, $metadata, $locale)) {
                return $locale;
            }
        } catch (PathNotFoundException $e) {
            // no node, document not persisted yet
            $node = null;
        }

        if (!$fallback) {
            $msg = sprintf('Document %s has no translation %s and fallback was not active', $this->getDocumentId($oid), $locale);

            throw new MissingTranslationException($msg);
        }

        $localesToTry = $this->dm->getLocaleChooserStrategy()->getFallbackLocales($document, $metadata, $locale);

        foreach ($localesToTry as $desiredLocale) {
            if (!$refresh && isset($this->documentLocales[$oid]['current']) && $desiredLocale == $this->documentLocales[$oid]['current']) {
                // noop, already the correct locale.
                return $desiredLocale;
            }
            // if there is a pending translation, it wins
            if ($this->doLoadPendingTranslation($document, $metadata, $desiredLocale)) {
                return $desiredLocale;
            }
            // try loading the translation with strategy if this is a stored document
            if ($node && $strategy->loadTranslation($document, $node, $metadata, $desiredLocale)) {
                return $desiredLocale;
            }
        }

        // we found no locale. so all translated fields are null and we
        // consider the locale to be the requested one
        $localeUsed = $locale;
        foreach ($metadata->translatableFields as $fieldName) {
            $value = ($metadata->mappings[$fieldName]['multivalue']) ? [] : null;
            $metadata->reflFields[$fieldName]->setValue($document, $value);
        }

        return $locale;
    }