protected override async Task <Result> Execute(RegisterUserCommand command)
        {
            var user   = new User(command.UserName, command.UserName, command.EMail);
            var result = await _userManager.CreateAsync(user, command.Password);

            return(result.ToCommandResult());
        }
        private async Task <User> Register(ExternalLoginCommand command)
        {
            var randomUserName = Guid.NewGuid().ToString();
            var user           = new User(randomUserName, command.UserName, command.EMail);

            var result = await _userManager.CreateAsync(user);

            if (!result.Succeeded)
            {
                var message = "Could not register external user";
                throw new BusinessException(message, message);
            }

            await _userManager.AddLoginAsync(user, new UserLoginInfo(command.ExternalIdentifier, command.ExternalType, command.UserName));

            if (!result.Succeeded)
            {
                var message = "Could not register external user login";
                throw new BusinessException(message, message);
            }

            return(user);
        }