public function compare(Money $a, Money $b) : int
    {
        $aCurrencyCode = $a->getCurrency()->getCurrencyCode();
        $bCurrencyCode = $b->getCurrency()->getCurrencyCode();

        if ($aCurrencyCode === $bCurrencyCode) {
            return $a->compareTo($b);
        }

        $aAmount = $a->getAmount();
        $bAmount = $b->getAmount();

        $exchangeRate = $this->exchangeRateProvider->getExchangeRate($aCurrencyCode, $bCurrencyCode);

        $aAmount = $aAmount->toBigRational()->multipliedBy($exchangeRate);

        return $aAmount->compareTo($bAmount);
    }