public function respondToFormAppropriately(array $params, $form = null, $redirect = '')
    {
        if ($redirect && !isset($params['redirect'])) {
            $params['redirect'] = $redirect;
        }

        if ($this->owner->Request->isAjax()) {
            if (!isset($params['code'])) {
                $params['code'] = 200;
            }
            if (!isset($params['code'])) {
                $params['status'] = 'success';
            }

            return singleton('director')->ajax_response($params, $params['code'], $params['status']);
        } else {
            if (isset($params['redirect'])) {
                $this->owner->redirect($params['redirect']);
            }

            if ($form && isset($params['message'])) {
                $form->sessionMessage($params['message'], 'good');
            }

            if (!$this->owner->redirectedTo()) {
                $this->owner->redirectBack();
            }
        }
    }