//Method for user registration
        public async Task<string> Register(string firstName, string lastName, string email, string password, string captchaResponse)
        {
            try
            {
                //CAPTCHA validation
                bool IsCaptchaValid = reCaptchaClass.Validate(captchaResponse) == "True" ? true : false;

                if (IsCaptchaValid)
                {
                    //Checking user data
                    if (firstName == null || lastName == null)
                        return _listOfErrors[1007].ToJson();

                    if (email == null)
                        return _listOfErrors[1008].ToJson();

                    //Сhecking e-mail on the registered
                    if (UserProfileRepository.UserIsRegistered(email))
                    {
                        return _listOfErrors[1009].ToJson();
                    }

                    //Creating new user
                    var user = new ApplicationUser
                    {
                        UserName = email,
                        Email = email,
                        FirstName = firstName,
                        LastName = lastName,
                        EmailConfirmed = false
                    };

                    var result = await _userManager.CreateAsync(user, password);

                    //Sending confirmation email of registration
                    if (result.Succeeded)
                    {
                        //Add user role
                        await _userManager.AddToRoleAsync(user, "User");

                        //Generation message body
                        var callbackUrl = GetLinkForUser(user, _listOfErrors[2003], "Account", "ConfirmEmail");

                        //Add message tempalate
                        string template = ResourceReader.GetTemplate("..//Templates//RegistrationConfirmationMessage.cshtml").Replace("@User", firstName);

                        //Sending message to user e-mail
                        SendEmail(email, "Confirm your account", template + "<a href=\"" + callbackUrl + "\">Registration confirmation</a>");

                        //User LogOff
                        await _signInManager.SignOutAsync();

                        return _listOfErrors[2002].ToJson();
                    }
                    else
                    {
                        return PasswordValidation(password);
                    }
                }
                else
                    return _listOfErrors[1001].ToJson();
            }
            catch (Exception ex)
            {
                return new Core.Error.Error(ex.HResult, ex.Source, ex.Message).ToJson();
            }
        }
 //#region Helpers
 //get link for user 
 public string GetLinkForUser(ApplicationUser user, Core.Error.Error parametr, string controller, string action)
 {
     var code = _userManager.GeneratePasswordResetTokenAsync(user);
     var url = Url.Action(action, controller, null, protocol: HttpContext.Request.Scheme);
     return url + string.Format("/?userId={0}&code={1}&successCode={2}", user.Id, code.Result, parametr.Code);
 }