private function parse() {
        $data = json_decode($this->httpResponse->getBody(), true);

        foreach ($data['messages'] as $message) {
            $msg = new Message($message);
            $this->messages[] = $msg;

            if ($message['type'] === 'error' || $message['type'] === 'non-document-error') {
                $this->errors[] = $msg;
            } else if ($message['type'] === 'warning') {
                $this->warnings[] = $msg;
            }
        }
    }