bool getXmpLangAltValue(Exiv2::XmpData &xmpData, const char *propertyName,
                            const QString &langAlt, QString &resultValue) {
        bool anyFound = false;

        Exiv2::XmpKey key(propertyName);
        Exiv2::XmpData::iterator it = xmpData.findKey(key);
        if ((it != xmpData.end()) && (it->typeId() == Exiv2::langAlt)) {
            const Exiv2::LangAltValue &value = static_cast<const Exiv2::LangAltValue &>(it->value());

            QString anyValue;

            Exiv2::LangAltValue::ValueType::const_iterator it2 = value.value_.begin();
            Exiv2::LangAltValue::ValueType::const_iterator end = value.value_.end();
            for (; it2 != end; ++it2) {
                QString lang = QString::fromUtf8(it2->first.c_str());

                if (langAlt == lang) {
                    QString text = QString::fromUtf8(it2->second.c_str()).trimmed();
                    if (!text.isEmpty()) {
                        anyFound = true;
                        resultValue = text.trimmed();
                        break;
                    }
                }

                if (anyValue.isEmpty()) {
                    QString text = QString::fromUtf8(it2->second.c_str());
                    anyValue = text.trimmed();
                }
            }

            if (!anyFound && !anyValue.isEmpty()) {
                anyFound = true;
                resultValue = anyValue;
            }
        }

        return anyFound;
    }
    bool getXmpDescription(Exiv2::XmpData &xmpData, const QString &langAlt, QString &description) {
        bool anyFound = false;

        try {
            anyFound = getXmpLangAltValue(xmpData, XMP_DESCRIPTION, langAlt, description);

            if (!anyFound || description.isEmpty()) {
                Exiv2::XmpKey psKey(XMP_PS_HEADLINE);
                Exiv2::XmpData::iterator xmpIt = xmpData.findKey(psKey);
                if (xmpIt != xmpData.end()) {
                    const Exiv2::XmpTextValue &value = static_cast<const Exiv2::XmpTextValue &>(xmpIt->value());
                    QString headline = QString::fromUtf8(value.value_.c_str()).trimmed();

                    if (!headline.isEmpty()) {
                        anyFound = true;
                        description = headline;
                    }
                }
            }
        }
        catch (Exiv2::Error &e) {
            LOG_WARNING << "Exiv2 error:" << e.what();
            anyFound = false;
        }
        catch (...) {
            LOG_WARNING << "Exception";
            anyFound = false;
#ifdef QT_DEBUG
            throw;
#endif
        }

        return anyFound;
    }