public async Task<ActionResult> Register(SummonerModel model)
        {
            ViewModel = await CreateViewModelAsync();
            if (!ModelState.IsValid)
            {
                return Error(ModelState);
            }

            // Rule: Summoner must not be registered to a User.
            if (await Summoners.IsSummonerRegistered(model.Region, model.SummonerName))
            {
                return Error("Summoner is already registered.");
            }

            // Rule: Summoner must exist.
            var cacheKey = string.Concat(model.Region, ":", model.SummonerName).ToLowerInvariant();
            var summoner = await CacheUtil.GetItemAsync(cacheKey,
                () => Riot.FindSummonerAsync(model.Region, model.SummonerName));

            if (summoner == null)
            {
                return Error("Summoner not found.");
            }

            return Success();
        }
 private async Task<ProfileViewModel> CreateViewModelAsync()
 {
     var viewModel = new ProfileViewModel
     {
         User = await Users.FindAsync(User.Identity.Name),
     };
     return viewModel;
 }
 public async Task<ActionResult> Index()
 {
     ViewModel = await CreateViewModelAsync();
     return View(ViewModel);
 }