public void Receive(Message received_message) { if (received_message.Properties["source"] == "sensor") { var sku = BOM.Skus.First(x => x.name == received_message.Properties["sku"]); var quality = System.Text.Encoding.UTF8.GetString(received_message.Content, 0, received_message.Content.Length) == "1" ? true : false; BOM.ConvertSku(sku.name, quality); if (!inventoryQualityTracking.ContainsKey(sku.name)) { inventoryQualityTracking.Add(sku.name, new InvTracking()); } inventoryQualityTracking[sku.name].CurrentIdx++; inventoryQualityTracking[sku.name].Tracking[inventoryQualityTracking[sku.name].CurrentIdx % 10] = quality ? 1 : 0; } }