BaseLayoutElement GetSelectedLayout() { if (Layouts.Count(l => l.IsSelected == true) > 0) { BaseLayoutElement selectedLayout = Layouts.Where(l => l.IsSelected == true) .ToList().SingleOrDefault(); return(selectedLayout); } else { Layouts[0].IsSelected = true; if (Get.i.Layouts.ContainsKey(Layouts[0].Id)) { Get.i.Layouts.SaveLayout(Layouts[0]); } else { Get.i.Layouts.InsertLayout(Layouts[0]); } } return(Layouts[0]); }