// Cleans an array by filtering out null elements, or objects with invalid time. // Could definitely be optimized a little bit, but since saving is done on a separate thread, I'm not too worried about it. private static JSONArray CleanupArray(JSONArray original) { JSONArray array = original.Clone().AsArray; foreach (JSONNode node in original) { if (node is null || node["_time"].IsNull || float.IsNaN(node["_time"])) { array.Remove(node); } } return(array); }