public async Task <ObjectResult> AzureValidateFile() { return(await ApiHelpers.HandleAzureEvents(Request, new Dictionary <string, Func <EventGridEvent, Task> > { { "Microsoft.Storage.BlobCreated", async(eventGridEvent) => { try { var blobName = eventGridEvent.Subject.Split($"{AzureSendFileStorageService.FilesContainerName}/blobs/")[1]; var sendId = AzureSendFileStorageService.SendIdFromBlobName(blobName); var send = await _sendRepository.GetByIdAsync(new Guid(sendId)); if (send == null) { if (_sendFileStorageService is AzureSendFileStorageService azureSendFileStorageService) { await azureSendFileStorageService.DeleteBlobAsync(blobName); } return; } await _sendService.ValidateSendFile(send); } catch (Exception e) { _logger.LogError(e, $"Uncaught exception occurred while handling event grid event: {JsonConvert.SerializeObject(eventGridEvent)}"); return; } } } }));