/// <summary>
        /// Determines whether the cache contains the specified route identifier.
        /// </summary>
        /// <param name="routeId">The route identifier.</param>
        /// <returns>A <see cref="Task{System.Boolean}" /> containing true if the identifier is found; otherwise false.</returns>
        public async Task <bool> ContainsAsync(long routeId)
        {
            await this.InitializeAsync();

            TableResult result = await this.routesCache.ExecuteAsync(TableOperation.Retrieve <RouteCacheEntity>((routeId / CosmosRouteCache.partitionSize).ToString(), routeId.ToString()));

            RouteCacheEntity routeEntity = result.Result as RouteCacheEntity;

            return(routeEntity != null);
        }
        /// <summary>
        /// Sets the route key asynchronously.
        /// </summary>
        /// <param name="routeKey">The route key.</param>
        /// <returns>An <see cref="Task{System.Int64}" /> representing the route identifier.</returns>
        public async Task <string> SetRouteKeyAsync(string routeName, string AnchorIdentifiers)
        {
            await this.InitializeAsync();

            RouteCacheEntity routeEntity = new RouteCacheEntity(CosmosRouteCache.partitionSize, "R_" + routeName)
            {
                AnchorIdentifiers = AnchorIdentifiers,
            };

            await this.routesCache.ExecuteAsync(TableOperation.InsertOrReplace(routeEntity));

            return(routeName);
        }
        /// <summary>
        /// Gets the route key asynchronously.
        /// </summary>
        /// <param name="routeId">The route identifier.</param>
        /// <exception cref="KeyNotFoundException"></exception>
        /// <returns>The route key.</returns>
        public async Task <string> GetRouteKeyAsync(string routeName)
        {
            await this.InitializeAsync();

            //TableResult result = await this.routesCache.ExecuteAsync(TableOperation.Retrieve<RouteCacheEntity>((routeId / CosmosRouteCache.partitionSize).ToString(), routeId.ToString()));
            TableResult result = await this.routesCache.ExecuteAsync(TableOperation.Retrieve <RouteCacheEntity>("0", "R_" + routeName));

            RouteCacheEntity routeEntity = result.Result as RouteCacheEntity;

            if (routeEntity != null)
            {
                return(routeEntity.AnchorIdentifiers);
            }

            throw new KeyNotFoundException($"The {nameof(routeName)} {routeName} could not be found.");
        }
        /// <summary>
        /// Deletes the route key asynchronously.
        /// </summary>
        /// <param name="routeId">The route identifier.</param>
        /// <exception cref="KeyNotFoundException"></exception>
        /// <returns>The route key.</returns>
        public async Task <string> DeleteRouteKeyAsync(string routeName)
        {
            await this.InitializeAsync();

            RouteCacheEntity routeCacheEntity = new RouteCacheEntity();

            routeCacheEntity.RowKey       = "R_" + routeName;
            routeCacheEntity.PartitionKey = "0";
            routeCacheEntity.ETag         = "*";
            //TableResult result = await this.routesCache.ExecuteAsync(TableOperation.Retrieve<RouteCacheEntity>((routeId / CosmosRouteCache.partitionSize).ToString(), routeId.ToString()));
            TableResult result = await this.routesCache.ExecuteAsync(TableOperation.Delete(routeCacheEntity));

            RouteCacheEntity routeEntity = result.Result as RouteCacheEntity;

            if (routeEntity != null)
            {
                return(routeName);
            }

            throw new KeyNotFoundException($"The {nameof(routeName)} {routeName} could not be found.");
        }