/// <summary>
        /// This private method is used to resolve a lookup reference from the cache.
        /// </summary>
        /// <param name="transform">The transform.</param>
        /// <param name="reference">The tuple type/value pair.</param>
        /// <returns>Returns triple with the first boolean property indicating success followed by the key and the version.</returns>
        private async Task <Tuple <bool, K, string> > RedisResolveReference(EntityTransformHolder <K, E> transform, Tuple <string, string> reference)
        {
            if (transform.KeyDeserializer != null)
            {
                try
                {
                    IDatabase rDb     = mLazyConnection.Value.GetDatabase();
                    RedisKey  hashkey = RedisReferenceKeyGet(transform, transform.ReferenceHashMaker(reference));

                    //Entity
                    RedisValue enitityId = await rDb.HashGetAsync(hashkey, cnKeyEntityId);

                    if (enitityId.HasValue)
                    {
                        K key = transform.KeyDeserializer(enitityId);
                        return(new Tuple <bool, K, string>(true, key, await rDb.HashGetAsync(hashkey, cnKeyVersion)));
                    }
                }
                catch (Exception)
                {
                    // Don't raise an exception here
                }
            }

            return(new Tuple <bool, K, string>(false, default(K), null));
        }
        /// <summary>
        /// This method writes out the references for the entity.
        /// </summary>
        /// <param name="batch">The redis batch.</param>
        /// <param name="transform">The entity transform.</param>
        /// <param name="reference">The reference.</param>
        /// <param name="key">The root key.</param>
        /// <param name="version">The entity version.</param>
        /// <param name="expiry">Expiry time of the key</param>
        /// <returns>Returns an async task.</returns>
        protected virtual List <Task> WriteReference(IBatch batch, EntityTransformHolder <K, E> transform, Tuple <string, string> reference, K key, string version, TimeSpan?expiry = null)
        {
            //entityreference.{entitytype}.{keytype i.e., EMAIL, ID etc.}
            RedisKey hashkey = RedisReferenceKeyGet(transform, transform.ReferenceHashMaker(reference));

            return(new List <Task>(3)
            {
                batch.HashSetAsync(hashkey, cnKeyEntityId, transform.KeySerializer(key), when: When.Always),
                batch.HashSetAsync(hashkey, cnKeyVersion, version, when: When.Always),
                batch.KeyExpireAsync(hashkey, expiry ?? mEntityTtl)
            });
        }