public function beforeDispatch(Event $event)
    {
        $this->buildResponse($event);
        Configure::write('requestLogged', false);
        $request = $event->getData()['request'];
        if ('OPTIONS' === $request->getMethod()) {
            $event->stopPropagation();
            $response = $event->getData()['response'];
            $response->getStatusCode(200);

            return $response;
        }

        if (empty($request->getData())) {
//            $request->data = $request->input('json_decode', true);
        }
    }