public JsonResult CreateUsers([DataSourceRequest] DataSourceRequest request, AdminExtendedUser user)
        {
            if (user != null && ModelState.IsValid)
            {
                var newUser = new ExtendedUser
                {
                   UserName = user.UserName,
                   FirstName = user.FirstName,
                   LastName = user.LastName,
                   Description = user.Description,
                   PictureUrl = user.PictureUrl.ToString()

                };

                this.Data.Users.Add(newUser);
                this.Data.SaveChanges();

                user.Id = newUser.Id;
            }

            return Json(new[] { user }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet);
        }
        public async Task<ActionResult> Register(ExtendedRegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                // Create a local login before signing in the user
                var user = new ExtendedUser 
                {
                    UserName = model.UserName,
                    FirstName = model.FirstName,
                    LastName = model.LastName,
                    Description = model.Description,
                    PictureUrl = DefaultProfilePictureUrl
                };
                var result = await IdentityManager.Users.CreateLocalUserAsync(user, model.Password);
                if (result.Success)
                {
                    await IdentityManager.Authentication.SignInAsync(AuthenticationManager, user.Id, isPersistent: false);
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    AddErrors(result);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }