public static Bundle Append(this Bundle bundle, IEnumerable<ResourceData> resourcesData) { if (!resourcesData.IsCollectionValid() && Bundle.BundleType.Searchset == bundle.Type) { Bundle.EntryComponent bundleEntry = new Bundle.EntryComponent(); OperationOutcome outcome = new OperationOutcome(); CodeableConcept codeableConcept = new CodeableConcept(); codeableConcept.Text = "There is no matching record found for the given criteria"; outcome.AddWarning(string.Format("Not Found"), OperationOutcome.IssueType.NotFound, codeableConcept); bundleEntry.Resource = outcome; bundleEntry.Resource.Id = "warning"; bundleEntry.Search = new Bundle.SearchComponent() { Mode = Bundle.SearchEntryMode.Outcome }; bundle.Entry.Add(bundleEntry); return bundle; } foreach (ResourceData resourceData in resourcesData) { bundle.Append(resourceData); } return bundle; }