public SrmDocument ChangeEntry(SrmDocument document, AuditLogEntry auditLogEntry) { var entries = new Stack <AuditLogEntry>(); foreach (var entry in document.AuditLog.AuditLogEntries.Enumerate()) { if (entry.LogIndex == Entry.LogIndex) { var newEntry = auditLogEntry.ChangeParent(entry.Parent); foreach (var e in entries) { newEntry = e.ChangeParent(newEntry); } return(document.ChangeAuditLog(newEntry)); } else { entries.Push(entry); } } return(document); }