public async Task <IActionResult> Edit(string name) { var calendar = await Scheduler.GetCalendar(name); var model = calendar.Flatten().Select(x => CalendarViewModel.FromCalendar(x)).ToArray(); if (model.Any()) { model[0].IsRoot = true; model[0].Name = name; } ViewBag.IsNew = false; return(View(model)); }