public function redirectUser(
        $id,
        $setFlash = true,
        $indexAction = ['index'],
        $editAction = ['edit'],
        $overrideReturnUrl = false
    ) {
        /** @var \yii\web\Controller $this */
        if ($setFlash === true) {
            Yii::$app->session->setFlash('success', AdminModule::t('app', 'Object saved'));
        } elseif (is_string($setFlash)) {
            Yii::$app->session->setFlash('success', $setFlash);
        }

        if ($overrideReturnUrl === false) {
            $returnUrl = Yii::$app->request->get(
                'returnUrl',
                Yii::$app->request->getReferrer() === null ? Url::to([$indexAction]) : Yii::$app->request->getReferrer()
            );
        } else {
            $returnUrl = $overrideReturnUrl;
        }

        switch (Yii::$app->request->post('action', 'save')) {
            case 'save-and-next':
                // as you can see there's no id param here and there should be no such in $editAction
                $url = $editAction;
                $url['returnUrl'] = $returnUrl;
                return $this->redirect($url);
            case 'save-and-back':
                return $this->redirect($returnUrl);
            default:
                $url = $editAction;
                $url['returnUrl'] = $returnUrl;
                $url['id'] = $id;
                return $this->redirect($url);
        }
    }