// Populate the List<> with blob logs for the given prefix.
        // http://blogs.msdn.com/b/windowsazurestorage/archive/2011/08/03/windows-azure-storage-logging-using-logs-to-track-storage-requests.aspx
        private static async Task GetLogsWithPrefixAsync(List <ICloudBlob> selectedLogs, CloudBlobClient blobClient,
                                                         string prefix, CancellationToken cancellationToken)
        {
            // List the blobs using the prefix
            IEnumerable <IListBlobItem> blobs = await blobClient.ListBlobsAsync(prefix,
                                                                                useFlatBlobListing : true, blobListingDetails : BlobListingDetails.Metadata,
                                                                                cancellationToken : cancellationToken);

            // iterate through each blob and figure the start and end times in the metadata
            // Type cast to IStorageBlob is safe due to useFlatBlobListing: true above.
            foreach (var item in blobs)
            {
                ICloudBlob log = item as ICloudBlob;
                if (log != null)
                {
                    // we will exclude the file if the file does not have log entries in the interested time range.
                    string logType   = log.Metadata[LogType];
                    bool   hasWrites = logType.Contains("write");

                    if (hasWrites)
                    {
                        selectedLogs.Add(log);
                    }
                }
            }
        }