public function cleanExpiredPreferences( $asOf = null, $name = null )
    {
        $count = 0;

        if( $asOf === null )
            $asOf = new \DateTime();
        elseif( is_int( $asOf ) )
            $asOf = new \DateTime( date( 'Y-m-d H:i:s', $asOf ) );
        elseif( is_string( $asOf ) )
            $asOf = new \DateTime( $asOf );

        foreach( $this->getPreferences() as $pref )
        {
            if( $name && ( $pref->getName() != $name ) )
                continue;

            if( $pref->getExpiresAt() && ( $pref->getExpiresAt() < $asOf ) )
            {
                $count++;
                $this->getPreferences()->removeElement( $pref );
                \D2EM::remove( $pref );
            }
        }

        return $count;
    }