private VersionedItem ReadMetadata(string id)
        {
            ConcurrentMetadata innerItem = _innerStore.ReadMetadata(id);

            if (innerItem == null)
            {
                return(null);
            }

            return(new VersionedItem(innerItem.ETag, GetVersion(innerItem.Metadata)));
        }
        private void DeleteIfLatest(IConcurrentMetadataTextStore store, ConcurrentMetadata blob)
        {
            bool deleted = false;
            string previousETag = null;
            ConcurrentMetadata currentItem;

            for (currentItem = blob;
                !deleted && currentItem != null;
                currentItem = store.ReadMetadata(blob.Id))
            {
                string currentETag = currentItem.ETag;

                // Prevent an infinite loop if _innerStore erroneously returns false from TryDelete when a retry won't
                // help. (The inner store should throw rather than return false in that case.)
                if (currentETag == previousETag)
                {
                    throw new InvalidOperationException("The operation stopped making progress.");
                }

                previousETag = currentETag;
                deleted = _functionsStore.TryDelete(blob.Id, blob.ETag);
            }
        }