public async Task <LicenseStorageItem> CreateLicense(IOtherLicenseDetails nomination)
        {
            var licenseId = Guid.NewGuid();

            RequestOptions dbOptions = new RequestOptions
            {
                PartitionKey = new PartitionKey(LicenseStorageItem.LicenseDatasetId.ToString())
            };

            var licenseStorageItem = new LicenseStorageItem
            {
                Id         = licenseId,
                IsStandard = false,
                Name       = nomination.OtherLicenseName
            };

            if (nomination.NominationLicenseType == NominationLicenseType.InputFile)
            {
                licenseStorageItem.FileName        = nomination.OtherLicenseFileName;
                licenseStorageItem.FileContentType = nomination.OtherLicenseFileContentType;
                licenseStorageItem.IsFileBased     = true;
                licenseStorageItem.FileContent     = nomination.OtherLicenseFileContent;
            }

            var documentCollection = this.DatasetDocumentCollectionUri;

            // Create document record
            ResourceResponse <Microsoft.Azure.Documents.Document> licenseRecord = await Client.UpsertDocumentAsync(
                documentCollection,
                licenseStorageItem,
                dbOptions);

            if (nomination.NominationLicenseType == NominationLicenseType.HtmlText)
            {
                await CreateHtmlContentLicenseContentAttachment(nomination, licenseRecord);
            }

            if (!string.IsNullOrEmpty(nomination.OtherLicenseAdditionalInfoUrl))
            {
                var licenseRecordLink = new Attachment
                {
                    Id          = "Source", // "Slug" is ID with hard-attach
                    ContentType = "text/plain",
                    MediaLink   = nomination.OtherLicenseAdditionalInfoUrl
                };

                var licenseRefAttachment = await Client.UpsertAttachmentAsync(licenseRecord.Resource.SelfLink,
                                                                              licenseRecordLink,
                                                                              dbOptions);
            }

            return(licenseStorageItem);
        }
        private async Task CreateHtmlContentLicenseContentAttachment(IOtherLicenseDetails nomination, ResourceResponse <Microsoft.Azure.Documents.Document> licenseRecord)
        {
            RequestOptions dbOptions = new RequestOptions
            {
                PartitionKey = new PartitionKey(LicenseStorageItem.LicenseDatasetId.ToString())
            };

            var contentRecordOptions = new MediaOptions
            {
                Slug        = "Content", // "Slug" is ID with hard-attach
                ContentType = "text/plain"
            };

            await Client.UpsertAttachmentAsync(
                licenseRecord.Resource.SelfLink,
                new MemoryStream(Encoding.UTF8.GetBytes(nomination.OtherLicenseContentHtml)),
                contentRecordOptions,
                dbOptions);
        }