public static async Task <bool> TryDownloadFileAsync()
        {
            string fileContents = "TryDownloadFileAsync";

            // Create a file
            var createdFile = await FilesSnippets.CreateFileAsync(STORY_DATA_IDENTIFIER + "_" + Guid.NewGuid().ToString(), new MemoryStream(Encoding.UTF8.GetBytes(fileContents)));

            if (createdFile == null)
            {
                return(false);
            }

            // Download the file
            using (var stream = await FilesSnippets.DownloadFileAsync(createdFile))
            {
                if (stream == null)
                {
                    return(false);
                }

                StreamReader reader           = new StreamReader(stream);
                var          downloadedString = await reader.ReadToEndAsync();

                if (downloadedString != fileContents)
                {
                    return(false);
                }
            }

            return(true);
        }
        public static async Task <bool> TryUpdateFileContentAsync()
        {
            // Add a file & verify
            // Grab a list of files
            var items = await FilesSnippets.GetFolderChildrenAsync("root");

            if (items == null)
            {
                return(false);
            }

            var origCount = items.Count;

            // Create a file
            var createdFileId = await FilesSnippets.CreateFileAsync(STORY_DATA_IDENTIFIER + "_" + Guid.NewGuid().ToString(), new MemoryStream(Encoding.UTF8.GetBytes("TryUpdateFileAsync")));

            if (createdFileId == null)
            {
                return(false);
            }

            // Grab the files again
            items = await FilesSnippets.GetFolderChildrenAsync("root");

            if (items == null)
            {
                return(false);
            }

            // Number of files should have increased by 1
            if (items.Count != origCount + 1)
            {
                return(false);
            }

            // Update the content

            string updatedContent = "Updated content";
            var    updated        = await FilesSnippets.UpdateFileContentAsync(createdFileId, new MemoryStream(Encoding.UTF8.GetBytes(updatedContent)));

            // Download the file and compare with the updated content.

            using (var stream = await FilesSnippets.DownloadFileAsync(createdFileId))
            {
                if (stream == null)
                {
                    return(false);
                }

                StreamReader reader           = new StreamReader(stream);
                var          downloadedString = await reader.ReadToEndAsync();

                if (downloadedString != updatedContent)
                {
                    return(false);
                }
            }

            //Cleanup
            await FilesSnippets.DeleteFileAsync(createdFileId);

            return(updated);
        }