public static async Task <WatchableCloudBlobStream> BindStreamAsync(IStorageBlob blob,
                                                                            ValueBindingContext context, IBlobWrittenWatcher blobWrittenWatcher)
        {
            IStorageBlockBlob blockBlob = blob as IStorageBlockBlob;

            if (blockBlob == null)
            {
                throw new InvalidOperationException("Cannot bind a page blob using an out string.");
            }

            BlobCausalityManager.SetWriter(blob.Metadata, context.FunctionInstanceId);

            CloudBlobStream rawStream = await blockBlob.OpenWriteAsync(context.CancellationToken);

            IBlobCommitedAction committedAction = new BlobCommittedAction(blob, blobWrittenWatcher);

            return(new WatchableCloudBlobStream(rawStream, committedAction));
        }