protected function findLanguage($code) {
        $language = Language::findOne($code);
        if ($language === null) {
            throw new \yii\web\NotFoundHttpException('The requested language does not exist');
        }
        return $language;
    }