public async Task <bool> Handle(ModifyUserRolesRequest message, IOutboundPort <BlankResponse> outputPort) { // fetch the user instance. var user = await _userStore.GetUserById(message.UserId); if (user == null) { return(false); } switch (message.Mode) { case ModifyUserRolesRequest.ModificationMode.Add: await _userStore.AddToRoles(user, message.DesiredRoles); return(true); case ModifyUserRolesRequest.ModificationMode.Set: await _userStore.RemoveRolesFromUser(user); await _userStore.AddToRoles(user, message.DesiredRoles); return(true); default: return(false); } }