private function buildBatchResponse($batch, $response) {
        $result = [];
        $responseBody = json_decode($response->raw_body, true);
        foreach ($batch as $collection => $events) {
            $eventResults = [];
            $eventResponses = $responseBody[$collection];
            foreach($events as $index => $event) {
                $eventResponse = $eventResponses[$index];
                $eventResult = new Response($eventResponse['success'], $eventResponse['duplicate'], null, $eventResponse['message'], $event);
                array_push($eventResults, $eventResult);
            }
            $result[$collection] = $eventResults;
        }

        $statusCode = $response->code;
        $errorMessage = $response->body->errorMessage;

        return new ResponseBatch($statusCode, $errorMessage, $result);
    }