public void MergeCloseEncounters() { var i = 0; while (i < Encounters.Count - 1) { var fifteenSec = new TimeSpan(0, 0, 0, 15); if (Encounters[i + 1].Start - Encounters[i].End < fifteenSec) { //Merge both encounters Encounters[i].End = Encounters[i + 1].End; ArrayManipulation.MergeEncounterDictionaries(Encounters[i].Players, Encounters[i + 1].Players); ArrayManipulation.MergeEncounterDictionaries(Encounters[i].NPC, Encounters[i + 1].NPC); ArrayManipulation.MergeEncounterDictionaries(Encounters[i].Pets, Encounters[i + 1].Pets); Encounters.RemoveAt(i + 1); --i; } ++i; } }