private DisplayLicenseViewModel SetupInternal( DisplayLicenseViewModel viewModel, Package package, IReadOnlyCollection <CompositeLicenseExpressionSegment> licenseExpressionSegments, string licenseFileContents, User currentUser) { viewModel.EmbeddedLicenseType = package.EmbeddedLicenseType; viewModel.LicenseExpression = package.LicenseExpression; if (PackageHelper.TryPrepareUrlForRendering(package.LicenseUrl, out string licenseUrl)) { viewModel.LicenseUrl = licenseUrl; var licenseNames = package.LicenseNames; if (!string.IsNullOrEmpty(licenseNames)) { viewModel.LicenseNames = licenseNames.Split(',').Select(l => l.Trim()).ToList(); } } viewModel.LicenseExpressionSegments = licenseExpressionSegments; viewModel.LicenseFileContents = licenseFileContents; if (_featureFlagService.IsLicenseMdRenderingEnabled(currentUser) && package.EmbeddedLicenseType == EmbeddedLicenseFileType.Markdown && licenseFileContents != null) { viewModel.LicenseFileContentsHtml = _markdownService.GetHtmlFromMarkdown(licenseFileContents)?.Content; } return(viewModel); }