private function findAvailableLocalization(array $availableLocales, array $localizations)
    {
        foreach ($localizations as $localization) {
            if (in_array($localization->getLocale(), $availableLocales)) {
                return $localization;
            }

            $children = $localization->getChildren();

            if ($children) {
                $result = $this->findAvailableLocalization($availableLocales, $children);

                if (null !== $result) {
                    return $result;
                }
            }
        }

        return;
    }