public async Task <RegisterUserResult> CreateAsync(UserAccount user)
        {
            RegisterUserResult result = new RegisterUserResult();

            UserAccountEntity newUser = GetUserEntityFromUser(user);

            result.UserId = newUser.Id;

            result.IdentityResult = await UserManager.CreateAsync(newUser);

            return(result);
        }
        // register the user via the UserManager (ASP.NET Identity 2.0)
        public async Task <RegisterUserResult> RegisterUser(UserAccount user)
        {
            try
            {
                RegisterUserResult result = new RegisterUserResult();

                UserAccountEntity newUser = GetUserEntityFromUser(user);
                result.UserId         = newUser.Id;
                result.IdentityResult = await TryRegisteringUser(newUser, user);

                return(result);
            }
            catch (Exception ex)
            {
                throw new RegisterUserException(user, ex);
            }
        }