public static Conversation <IEnumerable <FrameData> > GetConversation(this IReferencedCache <FlowKey, FrameKey, FrameData> frameCache, FlowKey flowKey, bool detectClientFromTimestamps = false) { var oppositeFlowKey = flowKey.SwapEndpoints(); var upflowPackets = frameCache.GetOrderedPackets(flowKey); var downflowPackets = frameCache.GetOrderedPackets(oppositeFlowKey); if (detectClientFromTimestamps) { var upTs = upflowPackets.FirstOrDefault()?.Timestamp; var downTs = downflowPackets.FirstOrDefault()?.Timestamp; if (upTs < downTs) { return(new Conversation <IEnumerable <FrameData> >(flowKey, upflowPackets, downflowPackets)); } else { return(new Conversation <IEnumerable <FrameData> >(oppositeFlowKey, downflowPackets, upflowPackets)); } } else { return(new Conversation <IEnumerable <FrameData> >(flowKey, upflowPackets, downflowPackets)); } }