public function addIndexedPreference( $name, $value, $expires = null, $max = 0 )
    {
        // what's the current highest index and how many is there?
        $highest = -1;
        $count = 0;

        foreach( $this->getPreferences() as $pref )
        {
            if( $pref->getName() == $name )
            {
                $count++;

                if( $pref->getIx() > $highest )
                    $highest = $pref->getIx();
            }
        }

        if( $max && ( $count >= $max ) )
            throw new IndexLimitException( 'Requested maximum number of indexed preferences reached' );

        if( is_array( $value ) )
        {
            foreach( $value as $v )
                $this->setPreference( $name, $value, $expires, ++$highest );
        }
        else
        {
            $this->setPreference( $name, $value, $expires, ++$highest );
        }

        return $this;
    }