public async Task <ActionResult <GetExchangeResponse> > GetExchange(GetExchangeRequest request)
 {
     try
     {
         _currencyController = _currencyControllerFactory.CreateCurrencyController(request.CurrencyCode.ToUpper());
         return(await _currencyController.GetExchange());
     }
     catch (ArgumentException argumentException)
     {
         _logger.LogError(argumentException, "Invalid currency");
         return(StatusCode(StatusCodes.Status400BadRequest, argumentException.Message));
     }
     catch (Exception exception)
     {
         _logger.LogError(exception, "Unhandled exception");
         return(StatusCode(StatusCodes.Status500InternalServerError, exception.Message));
     }
 }
        public override async Task <GetExchangeResponse> GetExchange(GetExchangeRequest request, ServerCallContext context)
        {
            BsonDocument bson;

            try
            {
                bson = mongoCollection.Find($"{{ _id: ObjectId('{request.Id}') }}").FirstOrDefault();
            }
            catch (Exception ex)
            {
                throw new RpcException(new Status(StatusCode.Unknown, $"Could get Exchange with id {request.Id} -> {ex.Message}"));
            }

            if (bson == null)
            {
                throw new RpcException(new Status(StatusCode.NotFound, $"Could not find Exchange with id {request.Id}"));
            }

            var exchange = new Exchange()
            {
                Country                     = bson.GetValue("country").AsString,
                Id                          = bson.GetValue("id").AsString,
                Name                        = bson.GetValue("name").AsString,
                HasTradingIncentive         = bson.GetValue("has_trading_incentive").AsString,
                Image                       = bson.GetValue("image").AsString,
                TradeVolume24HBtcNormalized = bson.GetValue("trade_volume_24h_btc_normalized").AsString,
                TrustScore                  = bson.GetValue("trust_score").AsString,
                TrustScoreRank              = bson.GetValue("score_rank").AsString,
                Url                         = bson.GetValue("url").AsString,
                YearEstablished             = bson.GetValue("year_established").AsString
            };
            var response = new GetExchangeResponse {
                Result = exchange
            };

            return(await Task.FromResult(response));
        }