public static function validationMessage($propertyName, $validationMessage = null, $tag = 'span', $htmlAttributes = array()) {
        $propertyName = (is_array($propertyName) ? implode('_', $propertyName) : $propertyName);
        $htmlAttributes = ($htmlAttributes === null ? array() : $htmlAttributes);
        $tag = empty($tag) ? 'div' : trim($tag, '<>');

        if (!isset($htmlAttributes['class'])) {
            $htmlAttributes['class'] = 'field-validation-error';
        }
        else {
            $htmlAttributes['class'] .= ' field-validation-error';
        }

        if (!empty($errors = self::$viewContext->getModelState()->getErrors($propertyName))) {
            $result = '<' . $tag . ' ' . self::buildAttributes($htmlAttributes) . '>';
            
            if (!empty($validationMessage)) {
                $result .= htmlspecialchars($validationMessage) . '<br />';
            }

            $result .= implode('<br />', array_map('htmlspecialchars', $errors));

            $result .= '</' . $tag . '>';

            return $result;
        }
    }