public async Task <ActionResult <BusinessLicenceDocument> > CreateBusinessLicenceDocument(int siteId, [FromQuery] Guid documentGuid)
        {
            var site = await _siteService.GetSiteAsync(siteId);

            if (site == null)
            {
                return(NotFound(ApiResponse.Message($"Site not found with id {siteId}")));
            }
            if (site.BusinessLicence == null)
            {
                return(NotFound(ApiResponse.Message($"Business Licence not found on site with id {siteId}")));
            }
            if (!site.Provisioner.PermissionsRecord().EditableBy(User))
            {
                return(Forbid());
            }
            if (site.BusinessLicence.BusinessLicenceDocument != null && site.SubmittedDate != null)
            {
                return(Conflict(ApiResponse.Message($"Business Licence Document exists for submitted site with id {siteId}")));
            }

            var document = await _siteService.AddOrReplaceBusinessLicenceDocumentAsync(site.BusinessLicence.Id, documentGuid);

            if (document == null)
            {
                ModelState.AddModelError("documentGuid", "Business Licence Document could not be created; network error or upload is already submitted");
                return(BadRequest(ApiResponse.BadRequest(ModelState)));
            }

            await _emailService.SendSiteRegistrationSubmissionAsync(siteId);

            // Send an notifying email to the adjudicator
            // if the site is calimed by a adjudicator, is a community pharmacy,
            // and previsouly deferred the business licence document.
            if (site.Adjudicator != null &&
                site.CareSetting.Code == (int)CareSettingType.CommunityPharmacy &&
                !string.IsNullOrEmpty(site.BusinessLicence.DeferredLicenceReason))
            {
                await _emailService.SendBusinessLicenceUploadedAsync(site);
            }

            return(Ok(ApiResponse.Result(document)));
        }