public JsonResult UploadAvatar()
        {
            var response = new JsonResult
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };

            try
            {
                var fileContent = Request.Files["avatar"];
                if (fileContent != null && fileContent.ContentLength > 0)
                {
                    // get a stream
                    var stream = fileContent.InputStream;
                    // and optionally write the file to disk
                    var img = new Bitmap(stream);
                    if (img.Height > Classes.Constants.MAXHEIGHT || img.Width > Classes.Constants.MAXWIDTH)
                    {
                        img = new Bitmap(img, new Size(img.Height - (img.Height - 500), img.Width - (img.Width - 500)));
                    }

                    try
                    {
                        var userId      = User.Identity.GetUserId();
                        var userProfile = _userProfileService.GetUserProfileByUserId(new Guid(userId));

                        var path = Path.Combine(Server.MapPath("~/Content/Avatars"), userProfile.Id + "_avatar.jpg");
                        img.Save(path);
                        var dbPath = "../../Content/Avatars/" + userId + "_avatar.jpg";
                        _userProfileService.ChangeUserProfileAvatar(userProfile.Id, dbPath);
                    }
                    catch (Exception e)
                    {
                        response.Data = new { message = e.Message };
                    }
                }
            }
            catch (Exception e)
            {
//                Response.StatusCode = (int) HttpStatusCode.BadRequest;
//                response.Data = new {message = e.Message + " " + e.StackTrace};
//                return response;
            }

            response.Data = new { message = "File uploaded successfully" };
            return(response);
        }