private void SetupAddCommand() { AddCommand = ReactiveCommand.CreateFromTask <Unit, Phone>(async unit => { var phoneWindow = new PhoneWindow(new PhoneViewModel()); if (phoneWindow.ShowDialog() == true) { var newPhone = phoneWindow.PhoneViewModel; var addedPhone = await _repository.AddAsync(newPhone).ConfigureAwait(true); return(addedPhone); } return(null); }); AddCommand.ObserveOn(MainThreadScheduler).Subscribe(newPhone => { Phones.Add(newPhone); }); AddCommand.ThrownExceptions.Subscribe(ex => { MessageBox.Show(ex.Message); }); }