public async Task<ActionResult> CheckKey(XBoxGame game, CancellationToken cancellationToken)
 {
         //Thread.Sleep(2000);
     await unitOfWork.XBoxGamesRepository.CheckKey(game.Title, cancellationToken);
     ViewBag.Result = "The key was successfully tested.";
     return View();
 }
 public ActionResult Vote(XBoxGame game)
 {
     try
     {
         if (!unitOfWork.XBoxGamesRepository.AddGameVote(game.ID))
         {
             ViewBag.Error = Common.ErrorMessage().ToString();
             return View();
         }
         // set cookie
         SetCookie("false");
         return RedirectToAction("Wantit", "XBoxGames");           
     }       
     catch (System.Exception)
     {
         // Normally I would save to db in Exception table
         // At minimum I will show error message on page
         ViewBag.Error = Common.ErrorMessage().ToString();
     }
     return View();
 }
 public ActionResult Buy(XBoxGame game)
 {
     try
     {
         if (!unitOfWork.XBoxGamesRepository.SetGotIt(game.ID))
         {
             ViewBag.Error = Common.ErrorMessage().ToString();
             return View();
         }                    
         return RedirectToAction("Gotit", "XBoxGames");                
     }
     catch (System.Exception)
     {
         // Normally I would save to db in Exception table
         // At minimum I will show error message on page
         ViewBag.Error = Common.ErrorMessage().ToString();
     }            
     return View();
 }
        public async Task<ActionResult> Create(XBoxGame game, CancellationToken cancellationToken)
        {
            if (ModelState.IsValid)
            {
                // Check if that name exists. It can't be added more than once
                if (unitOfWork.XBoxGamesRepository.ValidateGameTitle(game.Title))
                {
                    ViewBag.Error = "There is already a game with that name. Please change the name to proceed.";
                    return View();
                }
                //Thread.Sleep(2000);
                await unitOfWork.XBoxGamesRepository.AddGame(game.Title, cancellationToken);

                // need to set cookie before return
                SetCookie("false");     
                return RedirectToAction("Wantit");
            }
            return View();
        }