private string[] GetLayerIds(string[] exludedList, bool hideBasemaps)
        {
            if (Map != null && Map.Layers != null)
            {
                List <string> layerIds = new List <string>();
                foreach (Layer lay in Map.Layers)
                {
                    //always filter out layers without ID
                    if (!string.IsNullOrWhiteSpace(lay.ID) && LayerProperties.GetIsVisibleInMapContents(lay))
                    {
                        //only filter out basemaps for configurable MapContents controls
                        if ((bool)this.GetValue(ElementExtensions.IsConfigurableProperty) &&
                            hideBasemaps && (bool)lay.GetValue(ESRI.ArcGIS.Client.WebMap.Document.IsBaseMapProperty))
                        {
                            continue;
                        }
                        else
                        {
                            layerIds.Add(lay.ID);
                        }
                    }
                }
                //only filter using excludedList for configurable MapContents controls
                if ((bool)this.GetValue(ElementExtensions.IsConfigurableProperty) && exludedList != null)
                {
                    return(layerIds.Except <string>(exludedList).ToArray());
                }
                else
                {
                    return(layerIds.ToArray());
                }
            }

            return(null);
        }