private async Task <Section> SelectSectionAsync(Notebook notebook) { Log.Debug("loading sections..."); SectionsResponse allSections = await _client.GetNotebookSectionsAsync(notebook.Id); if (_settings.SectionName == null || allSections.Sections.FirstOrDefault(n => n.Name == _settings.SectionName) == null) { Log.Debug("select section"); int i = 0; foreach (Section section in allSections.Sections) { Log.Debug("{index}. {name}", ++i, section.Name); } int idx = AskNumber(); Section selected = allSections.Sections[idx - 1]; _settings.SectionName = selected.Name; Log.Debug("selected {name}", selected.Name); return(selected); } Section cached = allSections.Sections.First(s => s.Name == _settings.SectionName); Log.Debug("selected {name}", cached.Name); return(cached); }