public IHttpActionResult Get(int id, string name = null) { try { #region Preconditions if (id <= 0) { throw new ArgumentOutOfRangeException(); } #endregion var workingSet = workingSetRepository.GetItem(id); var awsConfigInfo = new DocumentGenerator.AwsConfigInfo(awsAccessKey, awsSecretKey, awsBucketName); var tenant = tenantRepository.GetTenant(); var documentRepositoryInfo = new DocumentRepositoryInfo(); documentRepositoryInfo.FilePath = $"{awsBucketOffset}/{tenant.Id}/{workingSet.Name.Replace(" ", "")}"; documentRepositoryInfo.WorkingSetId = workingSet.Id; documentRepositoryInfo.PolicyGenerationPropertiesEntries = policyGenerationPropertiesRepository.GetPolicyGenerationProperties(tenant.Id).PolicyGenerationPropertiesEntries; ConfigurationController configurationController = new ConfigurationController(); var configResult = configurationController.Get(); var configInfo = configResult as System.Web.Http.Results.OkNegotiatedContentResult <DTO.Configuration>; var sourceDirectory = configInfo.Content.ConfigurationEntries["ProfileAndProceduresSourceDir"]; AddToRepository(sourceDirectory, documentRepositoryInfo, awsConfigInfo); return(Ok()); } catch (Exception ex) { string res = ex.ToString(); return(InternalServerError()); } }