private function beautifyFlights($onlyFirstAgentPerItinerary): void
    {
        [$agents, $carriers, $legs] = $this->getMeta();
        foreach ($this->flights as &$flight) {
            // Find and assign each agent by ID
            foreach ($flight['Agents'] as $key => &$flightAgent) {
                $agent = $agents[$this->arraySearch($flightAgent->Agents[0], $agents, 'Id')];
                foreach ($agent as $property => $propertyValue) {
                    $flightAgent->$property = $propertyValue;
                }
                unset($flight['Agents'][$key]->Agents);
            }
            // Find and assign outbound and inbound legs
            foreach (['OutboundLeg' => 'OutboundLegId', 'InboundLeg' => 'InboundLegId'] as $key => $search) {
                if (isset($flight[$search])) {
                    $legId = $this->arraySearch($flight[$search], $legs, 'Id');
                    foreach ($legs[$legId]->FlightNumbers as $order => $legInformation) {
                        $carrierId = $this->arraySearch($legInformation->CarrierId, $carriers, 'Id');
                        $flightNumber = $legs[$legId]->FlightNumbers[$order]->FlightNumber;
                        $flightCode = $carriers[$carrierId]->Code . $flightNumber;
                        $legs[$legId]->FlightNumbers[$order]->FlightCode = $flightCode;
                        $legs[$legId]->FlightNumbers[$order]->Carrier = $carriers[$carrierId];
                    }
                    $flight[$key] = $legs[$legId];
                    if ($this->removeIds === true) {
                        unset($flight[$search]);
                    }
                }
            }
            $flight['Agent'] = $flight['Agents'][0];
            if ($onlyFirstAgentPerItinerary === true) {
                unset($flight['Agents']);
            }
        }
    }