private void AddItemToIngredients(ItemTree.Item item, List <ItemTree.Item> ingredients, bool onlyWithAssets) { if (item == null) { return; } item = itemTree.GetItem(item.Name); if (!ingredients.Contains(item)) { if (!onlyWithAssets || item.HasAsset) { ingredients.Add(item); } } foreach (var option in item.Options) { foreach (var child in option.Items) { AddItemToIngredients(child, ingredients, onlyWithAssets); } } }