private async Task <DialogTurnResult> CreateNote(DialogContext context, LuisResult result)
        {
            EntityRecommendation title;

            if (!result.TryFindEntity(EntityNoteTitle, out title))
            {
                // Prompt the user for a note title
                var options = new PromptDialogOptions()
                {
                    Prompt       = "What is the title of the note you want to create?",
                    ReturnMethod = PromptReturnMethods.After_TitlePrompt
                };
                return(await context.BeginDialogAsync(nameof(PromptWaterfallDialog), options));
            }
            else
            {
                var note = await this.currentNote.GetAsync(context.Context, () => new Note());

                note.Title = title.Entity;
                NoteByTitle[note.Title] = note;

                // Prompt the user for what they want to say in the note
                var options = new PromptDialogOptions()
                {
                    Prompt       = "What do you want to say in your note?",
                    ReturnMethod = PromptReturnMethods.After_TextPrompt
                };
                return(await context.BeginDialogAsync(nameof(PromptWaterfallDialog), options));
            }
        }
        private async Task <DialogTurnResult> DeleteNote(DialogContext context, LuisResult result)
        {
            Note note;

            if (this.TryFindNote(result, out note))
            {
                NoteByTitle.Remove(note.Title);
                await context.PostAsync($"Note {note.Title} deleted");

                return(new DialogTurnResult(DialogTurnStatus.Complete));
            }
            else
            {
                // Prompt the user for a note title
                var options = new PromptDialogOptions()
                {
                    Prompt       = "What is the title of the note you want to delete?",
                    ReturnMethod = PromptReturnMethods.After_DeleteTitlePrompt
                };
                return(await context.BeginDialogAsync(nameof(PromptWaterfallDialog), options));
            }
        }
        /// <summary>
        /// Executed after asking the user for the Title of the Note they wish to create.
        /// </summary>
        /// <param name="context">Current dialog context</param>
        /// <param name="noteTitle">Title of the note to create.</param>
        /// <returns>A DialogTurnResult</returns>
        private async Task <DialogTurnResult> After_TitlePrompt(DialogContext context, string noteTitle)
        {
            // Set the title (used for creation, deletion, and reading)
            if (string.IsNullOrEmpty(noteTitle))
            {
                noteTitle = DefaultNoteTitle;
            }

            // Add the new note to the list of notes and also save it in order to add text to it later
            var note = await this.currentNote.GetAsync(context.Context, () => new Note());

            note.Title = noteTitle;
            NoteByTitle[note.Title] = note;

            // Prompt the user for what they want to say in the note
            var options = new PromptDialogOptions()
            {
                Prompt       = "What do you want to say in your note?",
                ReturnMethod = PromptReturnMethods.After_TextPrompt
            };

            return(await context.BeginDialogAsync(nameof(PromptWaterfallDialog), options));
        }