private async Task<NewlyRegisteredUser> SignInAndAssociateGamingGroup(NewUser newUser, ApplicationUser newApplicationUser)
{
new Task(() => this.eventTracker.TrackUserRegistration(newUser.Source)).Start();
if (newUser.Source == TransactionSource.WebApplication)
{
await this.signInManager.SignInAsync(newApplicationUser, false, false);
}
NewlyRegisteredUser newlyRegisteredUser;
if (newUser.GamingGroupInvitationId.HasValue)
{
newlyRegisteredUser = this.gamingGroupInviteConsumer.AddNewUserToGamingGroup(newApplicationUser.Id, newUser.GamingGroupInvitationId.Value);
}
else
{
newlyRegisteredUser = await this.firstTimeUserAuthenticator.CreateGamingGroupAndSendEmailConfirmation(newApplicationUser, newUser.Source);
}
return newlyRegisteredUser;
}
}