public UserWallet CreateWallet(string username, string currency) { var user = _userService.FindByName(username); if (user != null && _currencyService.CheckForCurrencyExist(currency)) { currency = currency.ToUpper(); var w = _context.UserWallets.FirstOrDefault(x => x.Owner.Id == user.Id && x.CurrencyName == currency); if (w == null) { w = new UserWallet() { Owner = user, Amount = 0, CurrencyName = currency }; _context.Add(w); _context.SaveChanges(); } return(w); } return(null); }