public async Task <Client.Models.Survey> GetSurveyAsync(string slugName)
        {
            if (string.IsNullOrWhiteSpace(slugName))
            {
                throw new ArgumentException($"Required {nameof(slugName)} parameter is empty.");
            }

            try
            {
                var container = _surveyContainerFactory(SurveyListPartitionKeyAndContainerName);
                var survey    = await container.GetAsync(slugName);

                Client.Models.Survey result = null;
                if (survey != null)
                {
                    result = survey.ToSurvey();
                }

                return(result);
            }
            catch (Exception ex)
            {
                ServiceEventSource.Current.ServiceRequestFailed(ex.ToString());
                throw new SurveyManagementServiceException();
            }
        }
        public async Task <SurveyInformation> PublishSurveyAsync(Client.Models.Survey survey)
        {
            try
            {
                if (survey == null)
                {
                    throw new ArgumentNullException(nameof(survey));
                }

                if (string.IsNullOrEmpty(survey.SlugName) && string.IsNullOrEmpty(survey.Title))
                {
                    throw new ArgumentException($"{nameof(survey)} must have a slug or title");
                }
                var slugName = string.IsNullOrEmpty(survey.SlugName) ? GenerateSlug(survey.Title, 100) : survey.SlugName;
                survey.SlugName  = slugName;
                survey.CreatedOn = DateTime.UtcNow;
                var table     = _surveyInformationTableFactory(SurveyListPartitionKeyAndContainerName);
                var container = _surveyContainerFactory(SurveyListPartitionKeyAndContainerName);

                await table.EnsureExistsAsync();

                await container.EnsureExistsAsync();

                var row         = survey.ToSurveyRow(SurveyListPartitionKeyAndContainerName);
                var surveyModel = survey.ToSurvey();

                var existingRows = await table.GetByStringPropertiesAsync(new[]
                {
                    new KeyValuePair <string, string>(nameof(SurveyInformationRow.PartitionKey), row.PartitionKey),
                    new KeyValuePair <string, string>(nameof(SurveyInformationRow.SlugName), row.SlugName)
                });

                if (existingRows.Count > 0)
                {
                    throw new InvalidOperationException(
                              $"Survey with PartitionKey: {row.PartitionKey} and SlugName: {row.SlugName} is already published");
                }

                // The survey is not published, so save to blob storage first, then table.
                await container.SaveAsync(surveyModel.SlugName, surveyModel);

                await table.AddAsync(row);

                return(row.ToSurveyInformation());
            }
            catch (Exception ex)
            {
                ServiceEventSource.Current.ServiceRequestFailed(ex.ToString());
                throw new SurveyManagementServiceException();
            }
        }