private void SaveInvoice() { CurrentGroupItem.ChangedBy = DB.OracleSession.UserName; CurrentGroupItem.ChangedOn = DateTime.Now; foreach (ReportType reportType in ReportTypes) { bool bExists = false; foreach (InvoiceGrpReport igr in IgReports) { if (igr.REPORT_TYPE_ID == reportType.REPORT_TYPE_ID) { bExists = true; // Did they DESELECT the invoiceGroup?? if (reportType.IsSelected == false) { this.InvoiceGrpReportsTarget.Remove(igr); break; } } } // Add this invoiceGroup - it was not there previously if (bExists == false && reportType.IsSelected == true) { InvoiceGrpReport igr = new InvoiceGrpReport(); igr.INVOICE_GRP_ID = CurrentGroupItem.InvoiceGrpId; igr.REPORT_TYPE_ID = reportType.REPORT_TYPE_ID; this.InvoiceGrpReportsTarget.Add(igr); } } if (CurrentGroupItem.InvoiceGrpId == 0) { DataTarget.Add(CurrentGroupItem); } else { DataTarget.Update(CurrentGroupItem); } CurrentGroupItem.Modified = false; GroupVM.EnablePicker = true; RaisePropertyChanged("IsNotAddingNew"); }