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