private async Task SetDocumentPreferencesAsync() { var projectParameters = await _documentAppService.GetParametersAsync( new GetParametersDocumentInput { ProjectId = Project.Id, LanguageCode = DocumentLanguageCode, Version = Version }); if (projectParameters?.Parameters == null) { return; } var availableParameters = await _documentSectionRenderer.GetAvailableParametersAsync(Document.Content); DocumentPreferences = new DocumentParametersDto { Parameters = new List <DocumentParameterDto>() }; if (availableParameters == null || !availableParameters.Any()) { return; } foreach (var parameter in projectParameters.Parameters) { var availableParameter = availableParameters.GetOrDefault(parameter.Name); if (availableParameter != null) { var newParameter = new DocumentParameterDto { Name = parameter.Name, DisplayName = parameter.DisplayName, Values = new Dictionary <string, string>() }; foreach (var value in parameter.Values) { if (availableParameter.Contains(value.Key)) { newParameter.Values.Add(value.Key, value.Value); } } DocumentPreferences.Parameters.Add(newParameter); } } }