public ActionResult Edit(ImageUploadViewModel viewModel)
        {
            try
            {
                if (!ModelState.IsValid) return View("ProfileImage", viewModel);

                SaveUploadedFile(viewModel.ImageUpload, viewModel.UserId, false);

                return RedirectToAction("Details", "Users", new { id = viewModel.UserId });
            }
            catch (Exception ex)
            {
                _errorSignaler.SignalFromCurrentContext(ex);
                ViewBag.ErrorMessage = "Failed to get user image. Try refreshing the page.";
                return View("ProfileImage");
            }
        }
        private ImageUploadViewModel GetViewModel(int userId, bool isBackground)
        {
            var user = _usersResource.Get(userId);
            var model = new ImageUploadViewModel
                        {
                            UserId = userId,
                            Username = user.UserName,
                            IsBackground = isBackground,
                            MediaUrl = isBackground ? user.Background.MediaUrl : user.Picture.MediaUrl
                        };

            return model;
        }