private void Edit(object parameter) { int index = CurrentContainerCarParts.IndexOf(SelectedCurrentContainerCarPart); var viewModel = new EditContainerCarPartViewModel(SelectedCurrentContainerCarPart); HelperMethods.ShowView(viewModel, new AddEditContainerCarPartView()); var carPart = viewModel.CurrentNewContainerCarPart; CurrentContainerCarParts.RemoveAt(index); CurrentContainerCarParts.Insert(index, carPart); RecalculateTotalCarPart(); }