public async Task TogglePackageWithDefaultAction(PackageKey key, bool value) { var action = await key.DefaultPackageAction(); var selectedPackages = State.SelectedPackages; if (value) { if (await action.PackageKey.IsValidAction(action)) { selectedPackages[action.PackageKey] = action; } } else { selectedPackages.Remove(action.PackageKey); } var state = State; state.SelectedPackages = selectedPackages; _state.OnNext(state); }