public ActionResult Convert(ConvertViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                using (CryptoWalletDBContext ctx = new CryptoWalletDBContext())
                {
                    User CurrentUser = ctx.Users.AsNoTracking().FirstOrDefault(u => u.Email == User.Identity.Name);

                    UserBankAccount toAccount = ctx.UsersBankAccounts.FirstOrDefault(u => u.Currency == viewModel.IntoCurrency && u.UserId == CurrentUser.UserId);

                    UserBankAccount fromAccount = ctx.UsersBankAccounts.FirstOrDefault(u => u.Currency == viewModel.Currency && u.UserId == CurrentUser.UserId);

                    if (toAccount.Currency == fromAccount.Currency)
                    {
                        ModelState.AddModelError("", "Choose other currency!");

                        SetupConvertViewModel(viewModel);

                        return(View(viewModel));
                    }

                    if (fromAccount.Amount < viewModel.Amount)
                    {
                        ModelState.AddModelError("", "Insufficient funds!");

                        SetupConvertViewModel(viewModel);

                        return(View(viewModel));
                    }

                    ExchangeService cryptoExchange = new ExchangeService();

                    List <CurrencyRate> currencyRates = cryptoExchange.GetConversionRate(findCurrency(viewModel.Currency), new Currency[] { Currency.USD, Currency.GBP, Currency.BTC, Currency.XRP, Currency.EUR });

                    decimal rate = currencyRates.FirstOrDefault(u => u.Currency.ToString() == viewModel.IntoCurrency).Rate;

                    fromAccount.Amount -= viewModel.Amount;

                    toAccount.Amount += (viewModel.Amount * rate);

                    UserTransaction transaction = new UserTransaction
                    {
                        Amount          = viewModel.Amount,
                        ToAccountId     = toAccount.AccountId,
                        FromAccountId   = fromAccount.AccountId,
                        TransactionDate = DateTime.Now,
                        TransactionRate = (decimal)rate,
                        ToAccount       = toAccount,
                        FromAccount     = fromAccount
                    };

                    ctx.UsersTransactions.Add(transaction);

                    ctx.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }

            SetupConvertViewModel(viewModel);

            return(View(viewModel));
        }