public async Task <bool> UpdateProfileAsync(UpdateProfileCommand command) { var user = await _userManager.FindByNameAsync(command.Username); _userFactory.UpdateProfile(command, user); var claims = await _userManager.GetClaimsAsync(user); await AddOrUpdateClaim(claims, user, JwtClaimTypes.GivenName, command.Name); await AddOrUpdateClaim(claims, user, JwtClaimTypes.WebSite, command.Url); if (command.Birthdate.HasValue) { await AddOrUpdateClaim(claims, user, JwtClaimTypes.BirthDate, command.Birthdate.Value.ToString(CultureInfo.CurrentCulture)); } await AddOrUpdateClaim(claims, user, "company", command.Company); await AddOrUpdateClaim(claims, user, "job_title", command.JobTitle); await AddOrUpdateClaim(claims, user, "bio", command.Bio); await AddOrUpdateClaim(claims, user, "social_number", command.SocialNumber); var result = await _userManager.UpdateAsync(user); if (result.Succeeded) { return(true); } foreach (var error in result.Errors) { await _bus.RaiseEvent(new DomainNotification(result.ToString(), error.Description)); } return(false); }