private function getMaxInstallment($installments)
    {
        $final = $current = ['brand' => '', 'start' => 0, 'final' => 0, 'quantity' => 0];

        foreach ($installments as $key => $installment) {
            if ($current['brand'] !== $installment->getCardBrand()) {
                $current['brand'] = $installment->getCardBrand();
                $current['start'] = $key;
            }

            $current['quantity'] = $installment->getQuantity();
            $current['end'] = $key;

            if ($current['quantity'] > $final['quantity']) {
                $final = $current;
            }
        }
        
        return array_slice(
            $installments,
            $final['start'],
            $final['end'] - $final['start'] + 1
        );
    }