private void AddCar() { var car = new CarViewModel(); var dialog = new EditCarWindow(car, false); var result = dialog.ShowDialog(); if (result == true) { var seller = (SellerViewModel)cBoxGroup.SelectedItem; int sIndex = sellers.IndexOf(seller); sellerService.AddCarToSeller(seller.SellerId, car); dialog.Close(); ResetCollection(); cBoxGroup.SelectedIndex = sIndex; lBox.SelectedIndex = seller.Cars.IndexOf(seller.Cars.Last()); } }