public bool SaveUserChanges(UsersViewModel model)
        {
            try
            {
                Summoner summoner = this.GetSummoner(model.Id);

                summoner.Username = model.Username;
                summoner.LoLUsername = model.LolUsername;
                summoner.Server = model.Server;
                summoner.SummonersGames.First(g => g.GameId == (int)Games.Assasin).Experience = model.Assassin;
                summoner.SummonersGames.First(g => g.GameId == (int)Games.Fighter).Experience = model.Fighter;
                summoner.SummonersGames.First(g => g.GameId == (int)Games.Mage).Experience = model.Mage;
                summoner.SummonersGames.First(g => g.GameId == (int)Games.Support).Experience = model.Support;
                summoner.SummonersGames.First(g => g.GameId == (int)Games.Tank).Experience = model.Tank;
                summoner.SummonersGames.First(g => g.GameId == (int)Games.Marksman).Experience = model.Marksman;
                summoner.Synced = model.Synced;
                summoner.Score = model.Score;
                summoner.OverallScore = model.OverallScore;

                logsRep.logUserEdited(summoner, HttpContext.Current);

                db.SaveChanges();

                return true;
            }
            catch (Exception exc)
            {
                errorsRep.LogUsersRepositoryError(exc, "SaveUserChanges");
                return false;
            }
        }
        public IEnumerable<UsersViewModel> GetUsers()
        {
            var summoners =
                from summoner in db.Summoners
                select summoner;

            List<UsersViewModel> result = new List<UsersViewModel>();
            foreach (var summoner in summoners)
            {
                UsersViewModel user = new UsersViewModel(summoner);
                result.Add(user);
            }

            return result;
        }
        public ActionResult Edit(UsersViewModel model)
        {
            var server = Request["Servers"];
            model.Server = int.Parse(server);

            bool success = usersRep.SaveUserChanges(model);

            if (success)
            {
                return RedirectToAction("Index");
            }
            else
            {
                ViewBag.ErrorMsg = "Unable to edit user! See errors for an exception";
            }

            return View(model);
        }