public function generateLanguageMaskFromLanguageCodes(array $languageCodes, bool $isAlwaysAvailable = false): int
    {
        $mask = $isAlwaysAvailable ? 1 : 0;

        $languageList = $this->languageHandler->loadListByLanguageCodes($languageCodes);
        foreach ($languageList as $language) {
            $mask |= $language->id;
        }

        if ($missing = array_diff($languageCodes, array_keys($languageList))) {
            throw new NotFoundException('Language', implode(', ', $missing));
        }

        return $mask;
    }