public ActionResult Update(UserInfo userInfo)
        {
            try
            {
                var userPermissions = userInfo.Permissions;

                if (userInfo.Id == this.GetCurrentUserId())
                {
                    userPermissions.AllowManageUsers = true;
                }

                using (var db = new CheatNotesContext())
                {
                    var permissions = db.UserPermissions.FirstOrDefault(p => p.Id == userPermissions.Id);

                    if (permissions != null)
                    {
                        permissions.UpdateData(userPermissions);

                        db.Entry(permissions).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                }
            }
            catch
            {
            }

            return RedirectToAction("Index");
        }
        public static string CreateUserInfo(string userName)
        {
            try
            {
                using (var db = new CheatNotesContext())
                {
                    if (db.UserInfos.Any(x => x.UserName.Equals(userName, StringComparison.InvariantCultureIgnoreCase)))
                    {
                        return null;
                    }

                    var userInfo = new UserInfo
                    {
                        UserName = userName,
                        Permissions = UserPermissions.GetDefaultPermissions()
                    };

                    db.UserInfos.Add(userInfo);
                    db.SaveChanges();
                }

                return null;
            }
            catch (Exception e)
            {
                return e.ToString();
            }
        }