public ActionResult SaveUserPreferences(UserPreferencesViewModel model)
        {
            var serverResponse = new ResponseMessageViewModel();
            model.UserId = (int)Session["CurrentUserId"];

            if (_userService.UpdateUserPreferences(model))
            {
                serverResponse.AddSuccess(ResourceKeyResolver.SuccessUserPreferencesUpdated);
                }
            else
            {
                serverResponse.AddError(ResourceKeyResolver.ErrorUserPreferencesUpdated);
            }

            TempData["ServerResponse"] = serverResponse;

            return RedirectToAction("ChangedPreferencesRedirect");
        }
        public ActionResult ChangeAvatar(HttpPostedFileBase file)
        {
            var serverResponse = new ResponseMessageViewModel();

            if (file == null || file.ContentLength == 0)
            {
                serverResponse.AddError(ResourceKeyResolver.ErrorWrongAvatar);
            }
            else
            {
                var fileExtension = file.FileName.Split('.').Last(e => !e.IsEmpty());
                var fileName = $"{(int)Session["CurrentUserId"]}_avatar.{fileExtension}";
                var path = Path.Combine(Server.MapPath("~/Resources/Avatars"), fileName);

                file.SaveAs(path);
                _userService.AddAvatar((int)Session["CurrentUserId"], $"/Resources/Avatars/{fileName}");
                serverResponse.AddSuccess(ResourceKeyResolver.SuccessAvatarChanged);
            }

            TempData["ServerResponse"] = serverResponse;

            return RedirectToAction("ChangedPreferencesRedirect");
        }