public async Task <IResponse <NoteResourceResponse> > CreatePrivateNote(string notePath, string text)
        {
            mLogger.LogDebug($"Creating private note {notePath}");

            string fixedNotePath = GetFixedPrivateNotePath(notePath);

            if (File.Exists(fixedNotePath))
            {
                return(new FailResponse <NoteResourceResponse>($"File {notePath} is already exist"));
            }

            try
            {
                await File.WriteAllTextAsync(fixedNotePath, text).ConfigureAwait(false);

                NoteResourceResponse noteResponse = new NoteResourceResponse(
                    mTasksNotesDirectory, new string[] { fixedNotePath }, mNoteFactory);

                return(new SuccessResponse <NoteResourceResponse>(noteResponse));
            }
            catch (Exception ex)
            {
                return(new FailResponse <NoteResourceResponse>($"Failed to write note to path {notePath} due to exception: {ex.Message}"));
            }
        }
 private string GetText(NoteResourceResponse noteResourceResponse)
 {
     try
     {
         return(noteResourceResponse.Note.Text);
     }
     catch (Exception ex) when(ex is DirectoryNotFoundException || ex is FileNotFoundException)
     {
         return(string.Empty);
     }
 }
        public async Task <IResponse <NoteResourceResponse> > GetGeneralNote(string noteIdentifier)
        {
            NoteNode generalNotesStructure = await GetGeneralNotesStructure().ConfigureAwait(false);

            IEnumerable <string> notesPaths = await generalNotesStructure.FindRecursive(noteIdentifier).ConfigureAwait(false);

            NoteResourceResponse noteResponse = new NoteResourceResponse(
                mGeneralNotesDirectory, notesPaths, mNoteFactory);

            if (!noteResponse.IsNoteFound)
            {
                return(new FailResponse <NoteResourceResponse>($"No {noteIdentifier} note found"));
            }

            return(new SuccessResponse <NoteResourceResponse>(noteResponse));
        }
        public async Task <IResponse <NoteResourceResponse> > GetTaskNote(string noteIdentifier)
        {
            mLogger.LogDebug($"Creating notes file system structure from {mTasksNotesDirectory}");
            NoteNode tasksNotesStructure = new NoteNode(mTasksNotesDirectory);

            IEnumerable <string> notesPaths = await tasksNotesStructure.FindRecursive(noteIdentifier).ConfigureAwait(false);

            NoteResourceResponse noteResponse = new NoteResourceResponse(
                mTasksNotesDirectory, notesPaths, mNoteFactory);

            if (!noteResponse.IsNoteFound)
            {
                return(new FailResponse <NoteResourceResponse>($"No {noteIdentifier} note found"));
            }

            return(new SuccessResponse <NoteResourceResponse>(noteResponse));
        }