Internal class encapsulating a layer item representing a map layer. This class manages the events coming from the layer and the legend refresh process.
Inheritance: Esri.ArcGISRuntime.Toolkit.Controls.Primitives.LayerItemViewModel
        private void UpdateMapLayerItemsRecursive(ObservableCollection <LayerItemViewModel> mapLayerItems, IEnumerable <Layer> layers)
        {
            foreach (Layer layer in layers.Where(l => l.ShowLegend))
            {
                MapLayerItem mapLayerItem = FindMapLayerItem(layer);

                if (mapLayerItem == null) // else reuse existing map layer item to avoid query again the legend and to keep the current state (selected, expansed, ..)
                {
                    // Create a new map layer item
                    mapLayerItem = new MapLayerItem(layer)
                    {
                        LegendTree = this
                    };
                    mapLayerItem.Refresh();
                }

                mapLayerItems.Add(mapLayerItem);
                if (layer is GroupLayer)
                {
                    UpdateMapLayerItemsRecursive(mapLayerItems, (layer as GroupLayer).ChildLayers);
                }
            }
        }
        private void UpdateMapLayerItemsRecursive(ObservableCollection<LayerItemViewModel> mapLayerItems, IEnumerable<Layer> layers)
        {
            foreach (Layer layer in layers.Where(l => l.ShowLegend))
            {
                MapLayerItem mapLayerItem = FindMapLayerItem(layer);

                if (mapLayerItem == null) // else reuse existing map layer item to avoid query again the legend and to keep the current state (selected, expansed, ..)
                {
                    // Create a new map layer item
                    mapLayerItem = new MapLayerItem(layer) { LegendTree = this };
                    mapLayerItem.Refresh();
                }

                mapLayerItems.Add(mapLayerItem);
                if(layer is GroupLayer)
                    UpdateMapLayerItemsRecursive(mapLayerItems, (layer as GroupLayer).ChildLayers);
            }
        }