/// <summary> /// Processes the section from the external policy, applying it to the GeniusX policy. /// </summary> /// <param name="xiapHeader">The xiap header.</param> /// <param name="externalSection">The external section.</param> private void ProcessSection(Header xiapHeader, IUWSection externalSection) { Section section = null; SectionVersion sectionVersion = (SectionVersion)this.GetSectionForExternalRef(xiapHeader, externalSection.ExternalReference); if (sectionVersion == null) { // No section already exists on the GeniusX policy that matches the External Reference so we create one. section = xiapHeader.AddNewSection(externalSection.SectionTypeCode, externalSection.SubSectionTypeCode); this.UpdateSection(section, externalSection); // Add Summary SD if not already added and product allows it if (this.IsSummerySectionDetailAllowed(section.GetProduct().ProductSectionID)) { section.AddNewSectionDetail(section.GetProduct().ProductSectionDetails.Where(p=> this.sectionDetailTypes.Where(s=> s.Code == p.SectionDetailTypeCode).FirstOrDefault().IsSummarySectionDetailType == true).First().SectionDetailTypeCode,false); } } else { // map the section to the correct one from the GeniusX policy, retrieved via the Genius policy external reference section = sectionVersion.Section; } // Get all the external Section Details for this Section, ordered by the Genius Reference var sectiondetails = externalSection.ISectionDetails.OrderBy(x => x.ExternalReference); foreach (IUWSectionDetail externalSectionDetail in sectiondetails) { this.ProcessSectionDetail(section, externalSectionDetail); } }