private bool RequestShow(out string showTitle) { if (string.IsNullOrEmpty(Arguments)) { Program.Logger.Debug($"{GetType().Name}: Sending 'Enter show title' prompt"); try { TelegramApi.SendMessage(Message.From, "Введите название сериала"); } catch (Exception e) { throw new Exception($"{GetType().Name}: An error occurred while sending prompt", e); } Program.Logger.Debug($"{GetType().Name}: Waiting for a message that contains show title"); try { showTitle = TelegramApi.WaitForMessage(Message.From).Text; } catch (Exception e) { throw new Exception($"{GetType().Name}: An error occurred while waiting for a message that contains show title", e); } } else { showTitle = Arguments; } using (AppDbContext db = new AppDbContext()) { Program.Logger.Debug($"{GetType().Name}: Searching show {showTitle} in database"); var shows = db.GetShowsByTitle(showTitle); if (shows == null || shows.Count == 0) { return false; } var subscriptionCommands = string.Join("; ", shows.Select(s => $"{s.SiteType.Title}: {string.Format(SubscribeCommandFormat, s.Id)}")); TelegramApi.SendMessage(Message.From, subscriptionCommands); return true; } }