public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                //public string StreetAddress { get; set; }
                //public string AddressLine2 { get; set; }
                //public string City { get; set; }
                //public string Province { get; set; }
                //public string PostalCode { get; set; }
                //public double Latitude { get; set; }
                //public double Longitude { get; set; }


                try
                {
                    GeocodeValue geocodeValue;
                    geocodeValue    = GeocodingUtil.ConvertAddressToGeocode(AddressUtil.BuildAddrString(model.StreetAddress, model.AddressLine2, model.City, model.Province, model.PostalCode));
                    model.Latitude  = geocodeValue.Latitude;
                    model.Longitude = geocodeValue.Longitude;
                }
                catch (InvalidGeocodeInfoException e)
                {
                }

                var user = new ApplicationUser
                {
                    UserName      = model.UserName, Email = model.Email,
                    StreetAddress = model.UserName,
                    AddressLine2  = model.AddressLine2,
                    City          = model.City,
                    Province      = model.Province,
                    PostalCode    = model.PostalCode,
                    Latitude      = model.Latitude,
                    Longitude     = model.Longitude
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    result = await UserManager.AddToRoleAsync(user.Id, model.RoleName);

                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            List <SelectListItem> list = new List <SelectListItem>();

            foreach (var role in RoleManager.Roles)
            {
                list.Add(new SelectListItem()
                {
                    Value = role.Name, Text = role.Name
                });
            }
            ViewBag.Roles = list;

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