public async Task <Tenant> GetTenantAsync(string tenantId)
        {
            Func <Task <Tenant> > resolver = async() => await this.tenantBlobContainer.GetAsync(tenantId.ToLowerInvariant()).ConfigureAwait(false);

            if (this.CacheEnabled)
            {
                return(await TenantCacheHelper.GetFromCacheAsync(tenantId, TenantAccountTag, resolver).ConfigureAwait(false));
            }
            else
            {
                return(await resolver().ConfigureAwait(false));
            }
        }
        public async Task <Survey> GetSurveyByTenantAndSlugNameAsync(string tenant, string slugName, bool getQuestions)
        {
            Func <Task <Survey> > resolver = async() =>
            {
                var surveyRow = await GetSurveyRowByTenantAndSlugNameAsync(this.surveyTable, tenant, slugName);

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

                var survey = new Survey(surveyRow.SlugName)
                {
                    TenantId  = surveyRow.PartitionKey,
                    Title     = surveyRow.Title,
                    CreatedOn = surveyRow.CreatedOn
                };

                if (getQuestions)
                {
                    var surveyQuestionRows = await GetSurveyQuestionRowsByTenantAndSlugNameAsync(this.questionTable, tenant, slugName);

                    foreach (var questionRow in surveyQuestionRows)
                    {
                        survey.Questions.Add(
                            new Question
                        {
                            Text            = questionRow.Text,
                            Type            = (QuestionType)Enum.Parse(typeof(QuestionType), questionRow.Type),
                            PossibleAnswers = questionRow.PossibleAnswers
                        });
                    }
                }

                return(survey);
            };

            if (this.CacheEnabled)
            {
                return(await TenantCacheHelper.GetFromCacheAsync(tenant, slugName, resolver).ConfigureAwait(false));
            }
            else
            {
                return(await resolver().ConfigureAwait(false));
            }
        }