private static CoreStandards ApplyPatchToCoreStandards(StandardIdentifier identifier, CoreStandards coreStandards, CoreStandardsXml standardsXml, ItemPatch patch) { string claimNumber = Regex.Match(input: patch.Claim, pattern: @"\d+").Value; if (identifier == null) { identifier = StandardIdentifier.Create(claim: claimNumber, target: patch.Target); } else { string target = (!string.IsNullOrEmpty(patch.Target)) ? patch.Target : identifier.Target; claimNumber = (!string.IsNullOrEmpty(claimNumber)) ? claimNumber : identifier.Claim; identifier = identifier.WithClaimAndTarget(claimNumber, target); } string targetDesc = (!string.IsNullOrEmpty(patch.TargetDescription)) ? patch.TargetDescription : coreStandards?.TargetDescription; string ccssDesc = (!string.IsNullOrEmpty(patch.CCSSDescription)) ? patch.CCSSDescription : coreStandards?.CommonCoreStandardsDescription; coreStandards = StandardIdentifierTranslation.CoreStandardFromIdentifier(standardsXml, identifier); coreStandards = coreStandards.WithTargetCCSSDescriptions(targetDesc, ccssDesc); return(coreStandards); }