private void OnSerializingMethod(StreamingContext context) { SerializableLayerMaps.Clear(); SerializableSelectedLayerMap = null; SerializableLayerMaps.AddRange(LocalLayerMaps); if (SelectedLayerMap != null && WorkflowController.IsLocalLayer(SelectedLayerMap.MapType)) { if (SelectedLayerMap.IsValid) { SerializableSelectedLayerMap = SelectedLayerMap; } else { SelectedLayerMap = null; } } }