public function process(\Controller $controller, $result = null)
    {
        if ($controller->getRequest()->isAjax()) {
            $response = $controller->getResponse();
            $response->setStatusCode(200);

            if (is_array($result)) {
                $response->addHeader('Content-Type', 'application/json');
                $response->setBody(json_encode($result));
            }

            return $response;
        } else {
            $controller->redirectBack();
        }

        return null;
    }