public async Task <WriteFileRecordResult> WriteFileRecord(IFileRecord fr) { var dir = fr.DirectoryPath(Root); var pattern = fr.FileNamePattern; var paths = await IO.GetFilePathsAsync(dir, pattern); var currPath = paths.LastOrDefault(); if (currPath == null) { return(await CreateFileRecord(fr, dir)); } else { return(await UpdateFileRecord(fr, dir, currPath)); } }