private AlarmMenu CreateMenu()
        {
            var rootMenu = new AlarmMenu()
            {
                ToBack    = null,
                GetAnswer = (userState, alarmItems) => Answer
                            .MenuAnswer(userState.UserId,
                                        GetName(),
                                        new[] { "Все будильники", "Добавить будильник" }),
                NextMenu      = new List <AlarmMenu>(),
                RequestFormat = ExpectingRequestFormat.Number,
                Action_       = SelectNextMenu
            };

            rootMenu.Root = rootMenu;

            var enterNameMenu = new AlarmMenu()
            {
                ToBack        = rootMenu,
                Root          = rootMenu,
                GetAnswer     = (userState, alarmItems) => Answer.AskForText(userState.UserId, "Добавление будильника\nВведите название будильника:"),
                NextMenu      = new List <AlarmMenu>(),
                RequestFormat = ExpectingRequestFormat.Text,
                Action_       = CreateAlarmItemWithOutTime
            };

            var allAlarmList = new AlarmMenu()
            {
                ToBack        = rootMenu,
                Root          = rootMenu,
                GetAnswer     = (userState, alarmItems) => Answer.ListAnswer(userState.UserId, "Список будильников:", alarmItems.Select(alarmItem => alarmItem.ToString()).ToArray()),
                NextMenu      = new List <AlarmMenu>(),
                RequestFormat = ExpectingRequestFormat.Number,
                Action_       = SelectAlarmItem
            };

            rootMenu.NextMenu.Add(allAlarmList);
            rootMenu.NextMenu.Add(enterNameMenu);

            var enterTimeMenu = new AlarmMenu()
            {
                ToBack    = rootMenu,
                Root      = rootMenu,
                GetAnswer = (userState, alarmItems) => Answer.AskForTime(userState.UserId),
                NextMenu  = new List <AlarmMenu>()
                {
                    rootMenu
                },
                RequestFormat = ExpectingRequestFormat.OnlyTimeDateTime,
                Action_       = AddAlarmItemWithTime
            };

            enterNameMenu.NextMenu.Add(enterTimeMenu);

            var pitchAlarmMenu = new AlarmMenu()
            {
                ToBack    = allAlarmList,
                Root      = rootMenu,
                GetAnswer = (userState, alarmItems) => Answer
                            .ListAnswer(userState.UserId, "Что вы хотите сделать, с выбранным будильником:", new string[] { "Удалить", "Изменить" }),
                NextMenu      = new List <AlarmMenu>(),
                RequestFormat = ExpectingRequestFormat.Number,
                Action_       = SelectNextMenu
            };

            allAlarmList.NextMenu.Add(pitchAlarmMenu);

            var removeAlarmItemMenu = new AlarmMenu()
            {
                ToBack    = allAlarmList,
                Root      = rootMenu,
                GetAnswer = (userState, alarmItems) => Answer.ListAnswer(userState.UserId, string.Format("Удалить будильник {0}?", alarmItemForEdit[userState.UserId].ToString()), new string[] { "Да", "Нет" }),
                NextMenu  = new List <AlarmMenu>()
                {
                    allAlarmList
                },
                RequestFormat = ExpectingRequestFormat.Number,
                Action_       = RemoveAlarmItem
            };

            var editAlarmItemMenu = new AlarmMenu()
            {
                ToBack        = allAlarmList,
                Root          = rootMenu,
                GetAnswer     = (userState, alarmItem) => Answer.ListAnswer(userState.UserId, string.Format("Изменить время или название\nбудильника {0}?", alarmItemForEdit[userState.UserId].ToString()), new string[] { "Изменить время", "Изменить название" }),
                NextMenu      = new List <AlarmMenu>(),
                RequestFormat = ExpectingRequestFormat.Number,
                Action_       = SelectNextMenu
            };

            pitchAlarmMenu.NextMenu.Add(removeAlarmItemMenu);
            pitchAlarmMenu.NextMenu.Add(editAlarmItemMenu);

            var editTime = new AlarmMenu()
            {
                ToBack    = allAlarmList,
                Root      = rootMenu,
                GetAnswer = (userState, alarmItem) => new Answer
                {
                    Format     = ExpectingRequestFormat.OnlyTimeDateTime,
                    UserId     = userState.UserId,
                    Headline   = string.Format("Введите новое время для\nбудильника {0}:", alarmItemForEdit[userState.UserId].ToString()),
                    IsBackward = false,
                    Items      = new string[0]
                },
                NextMenu = new List <AlarmMenu>()
                {
                    allAlarmList
                },
                RequestFormat = ExpectingRequestFormat.OnlyTimeDateTime,
                Action_       = EditTimeAlarmItem
            };

            var editName = new AlarmMenu()
            {
                ToBack    = allAlarmList,
                Root      = rootMenu,
                GetAnswer = (userState, alarmItem) => Answer.AskForText(userState.UserId, string.Format("Введите новое название для\nбудильника {0}:", alarmItemForEdit[userState.UserId].ToString())),
                NextMenu  = new List <AlarmMenu>()
                {
                    allAlarmList
                },
                RequestFormat = ExpectingRequestFormat.Text,
                Action_       = EditNameAlarmItem
            };

            editAlarmItemMenu.NextMenu.Add(editTime);
            editAlarmItemMenu.NextMenu.Add(editName);

            return(rootMenu);
        }
 public AlarmOrganizerItem()
 {
     alarmMenu = CreateMenu();
 }