private string RescueSequence(string registryID, string noteID) { XmlNode rescues = null; ThisAddIn.RescueTime(registryID, ref rescues); if (rescues == null) { return(null); } XmlNodeList emrNotes = emrDoc.DocumentElement.SelectNodes(ElementNames.EmrNote); XmlNode congeners = ThisAddIn.GetCongener0(noteID, emrNotes); if (congeners.ChildNodes.Count == 0) { return(rescues.FirstChild.Attributes[AttributeNames.RescueSequence].Value); } string sequence = null; foreach (XmlNode rescue in rescues.ChildNodes) { string commitT = ""; sequence = rescue.Attributes[AttributeNames.RescueSequence].Value; if (ThisAddIn.NoteExistsWithSequence(AttributeNames.RescueSequence, sequence, congeners, ref commitT) != null && commitT != "") { continue; } break; } return(sequence); }