private void BuildPacketInfo() { Log.Debug("Building packet info"); IReadOnlyCollection <PacketInfo> packetInfo = new PacketInfoBuilder().BuildPacketInfo(); _packetsByType = packetInfo.ToDictionary(p => p.Type); foreach (NetworkState state in Enum.GetValues(typeof(NetworkState))) { var container = new StateContainer(); foreach (PacketInfo packet in packetInfo.Where(p => p.State == state)) { container.AddPacketInfo(packet); } _packetsByState.Add(state, container); } }