public async Task <bool> Handle(CreateInvestmentCommand message, CancellationToken cancellationToken) { //Prepare a new investment. try { var investment = Investment.FromType( InvestmentType.FromName(message.InvestmentType), message.ExchangeId, message.BaseCurrency, message.QuoteCurrency, new Account(message.Username) ); _investmentRepository.Add(investment); await _investmentRepository.UnitOfWork .SaveChangesAsync(); } catch (Exception ex) { Console.WriteLine("Handle Command: CreateInvestmentCommand."); Console.WriteLine("Result: Failure."); Console.WriteLine("Error Message: " + ex.Message); return(false); } return(true); }