private function processXmlReturn(SimpleXMLElement $xml)
    {
        if (isset($xml->error)) {
            if (isset($xml->error['@attributes'])) {
                $this->lastStatus = (int)$xml->error['@attributes']['code'];
                if (isset($xml->error['@attributes']['resettimer'])) {
                    $this->apiLimitReset
                        = (int)$xml->error['@attributes']['resettimer'];
                }
            }
            throw new RuntimeException($xml->error, $this->lastStatus);
        }

        if (!isset($xml->success)) {
            throw new RuntimeException(
                'Unexpected NMA API response',
                500
            );
        }

        $this->lastStatus = (int)$xml->success['@attributes']['code'];
        $this->apiCallsRemaining
            = (int)$xml->success['@attributes']['remaining'];
        $this->apiLimitReset = (int)$xml->success['@attributes']['resettimer'];

        return $this;
    }