public static function isValid($user)
    {
        if (Yii::$app instanceof \yii\web\Application && !Yii::$app->user->isGuest)
        {
            return Yii::$app->user->identity;
        }
        if (!($user instanceof static)) {
            return false;
        }
        return $user->find()->guid($user)->exists() ? $user : false;
    }