internal TitleStorageBlobMetadataResult HandleBlobMetadataResult(
            XboxLiveUser user,
            Task <XboxLiveHttpResponse> responseTask,
            TitleStorageType storageType,
            string blobPath)
        {
            var response = responseTask.Result;

            return(TitleStorageBlobMetadataResult.Deserialize(
                       response.ResponseBodyString,
                       storageType,
                       user,
                       blobPath));
        }
        /// <summary>
        /// Deserializes the TitleStorageBlobMetadataResult from JSON
        /// </summary>
        /// <param name="json">JSON string</param>
        /// <param name="storageType">Type of title storage </param>
        /// <param name="xboxUser">The Xbox User of the player the files belongs to.</param>
        /// <param name="blobPath">The full path to to the blob.  examples: "gameconfig.json" and "user/settings/playerconfiguration.json".</param>
        /// <returns></returns>
        public static TitleStorageBlobMetadataResult Deserialize(
            string json,
            TitleStorageType storageType,
            XboxLiveUser xboxUser,
            string blobPath
            )
        {
            var titleStorageBlobMetadataResultInfo = JsonSerialization.FromJson <TitleStorageBlobMetadataResultInfo>(json);

            TitleStorageBlobMetadataResult.User = xboxUser;
            var titleMetadataResult = new TitleStorageBlobMetadataResult
            {
                Items       = new List <TitleStorageBlobMetadata>(),
                storageType = storageType,
                blobPath    = blobPath
            };

            foreach (var blob in titleStorageBlobMetadataResultInfo.Blobs)
            {
                var blobFileName = blob.BlobPath;

                // Since the blobPath returned from the service contains the type of the blob
                // such as (foo\bar\blob.txt,json)
                // It needs to be split out so the blobPath is only the first part and the
                // blob type is JSON.
                var nameParts = blobFileName.Split(',');
                blobFileName = nameParts[0];
                var blobFileType = (TitleStorageBlobType)Enum.Parse(typeof(TitleStorageBlobType), nameParts[1], true);

                var newTitleStorageBlobMetadata = new TitleStorageBlobMetadata(storageType, blobFileName, blobFileType, blob.DisplayName, blob.ETag);
                titleMetadataResult.Items.Add(newTitleStorageBlobMetadata);
            }

            if (titleStorageBlobMetadataResultInfo.PagingInfo != null)
            {
                titleMetadataResult.continuationToken = titleStorageBlobMetadataResultInfo.PagingInfo.ContinuationToken;
            }

            return(titleMetadataResult);
        }