/**
     * @param string $remote_id
     * @param string $cluster_identifier
     * @param string $description
     * @param string $url
     * @param string $application
     * @return array
     */
    protected function addToMySelection( $remote_id = null, $cluster_identifier = null, $description = null, $url = null, $application = null )
    {
        if( is_null( $remote_id ) )
            $remote_id = isset( $_POST['remote_id'] ) ? $_POST['remote_id'] : null;

        if( is_null( $cluster_identifier ) )
            $cluster_identifier = isset( $_POST['cluster_identifier'] ) ? $_POST['cluster_identifier'] : null;

        if( is_null( $description ) )
            $description = isset( $_POST['description'] ) ? strip_tags(html_entity_decode($_POST['description'])) : null;

        if( is_null( $url ) )
            $url = isset( $_POST['url'] ) ? strip_tags(urldecode($_POST['url'])) : null;

        if( is_null( $application ) )
            $application = ( isset( $_POST['application'] ) && filter_var($_POST['application'], FILTER_VALIDATE_INT) ) ? $_POST['application'] : null;

        if ( $remote_id == null || $cluster_identifier == null || $url == null || $application == null )
            return false;

        return array(
            'result' => MMSelections::addToMySelection( $remote_id, $cluster_identifier, $description, $url, $application )
        );
    }
    /**
     * @return int
     */
    protected function startCourse()
    {
        $nodeId = ( isset( $_POST['nid'] ) && filter_var($_POST['nid'], FILTER_VALIDATE_INT) ) ? $_POST['nid'] : null;

        if( is_null($nodeId) )
            return null;

        $node = eZContentObjectTreeNode::fetch($nodeId);

        if( !$node )
            return null;

        /* @type $dataMap eZContentObjectAttribute[] */
        $dataMap        = $node->dataMap();
        $description    = '';

        if( $dataMap['promo_description']->hasContent() )
        {
            $description = $dataMap['promo_description']->content();
        }

        $application    = $this->applicationObject()->attribute( 'identifier' );
        $applicationId  = $this->applicationObject()->attribute( 'id' );
        $url            = NodeOperatorHelper::getUrlNode( $application, $node );

        return MMSelections::addToMySelection( $node->object()->remoteID(), ClusterTool::clusterIdentifier(), $description, $url, $applicationId );
    }
    /**
     * @return array
     * @throws Exception
     */
    public static function selectionAdd()
    {
        $applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByApplication($_POST['application']);
        if ( !$applicationLocalized )
        {
            throw new Exception('Application not found', 52);
        }

        $application = $applicationLocalized->applicationObject();

        $node = eZContentObjectTreeNode::fetch($_POST['node_id']);
        if ( !$node )
        {
            throw new Exception('Node not found', 53);
        }

        $count = MMSelections::addToMySelection($_POST['node_id'], ClusterTool::clusterIdentifier(), $_POST['description'], $_POST['url'], $application->attribute('id'));
        return array('count' => $count);
    }