static private function createAndLinkTag( eZContentObjectAttribute $attribute, $parentID, $parentPathString, $parentDepth, $keyword, $locale, $priority )
    {
        $languageID = eZContentLanguage::idByLocale( $locale );
        if ( $languageID === false )
            return;

        $ini = eZINI::instance( 'eztags.ini' );
        $alwaysAvailable = $ini->variable( 'GeneralSettings', 'DefaultAlwaysAvailable' );
        $alwaysAvailable = $alwaysAvailable === 'true' ? 1 : 0;

        $tagObject = new eZTagsObject( array(
            'parent_id'        => $parentID,
            'main_tag_id'      => 0,
            'depth'            => $parentDepth + 1,
            'path_string'      => $parentPathString,
            'main_language_id' => $languageID,
            'language_mask'    => $languageID + $alwaysAvailable ), $locale );
        $tagObject->store();

        $tagKeywordObject = new eZTagsKeyword( array(
            'keyword_id'  => $tagObject->attribute( 'id' ),
            'language_id' => $languageID + $alwaysAvailable,
            'keyword'     => $keyword,
            'locale'      => $locale,
            'status'      => eZTagsKeyword::STATUS_PUBLISHED ) );
        $tagKeywordObject->store();

        $tagObject->setAttribute( 'path_string', $tagObject->attribute( 'path_string' ) . $tagObject->attribute( 'id' ) . '/' );
        $tagObject->store();
        $tagObject->updateModified();

        $linkObject = new eZTagsAttributeLinkObject( array(
            'keyword_id'              => $tagObject->attribute( 'id' ),
            'objectattribute_id'      => $attribute->attribute( 'id' ),
            'objectattribute_version' => $attribute->attribute( 'version' ),
            'object_id'               => $attribute->attribute( 'contentobject_id' ),
            'priority'                => $priority ) );
        $linkObject->store();

        if ( class_exists( 'ezpEvent', false ) )
        {
            ezpEvent::getInstance()->filter(
                'tag/add',
                array(
                    'tag' => $tagObject,
                    'parentTag' => $tagObject->getParent( true )
                )
            );
        }
    }