public static function getUserConfig($key, $default=NULL)
    {
        $uid = Yii::app()->user->id;
        $data = Yii::app()->db->createCommand('SELECT value FROM user_metadata AS t WHERE t.key = :key AND t.user_id = :id')
                              ->bindParam(':id', $uid)
                              ->bindParam(':key', $key)
                              ->queryAll();

        if (!isset($data[0]['value']))
            return NULL;

        return $data[0]['value'];
    }