public static async void Run([BlobTrigger(route, Connection = ConfigSettings.STORAGE_CONNECTIONSTRING_NAME)] CloudBlockBlob blockBlob, string name, ILogger log)
        {
            await blockBlob.FetchAttributesAsync();

            log.LogInformation("[PENDING] Checking for required metadata on job entry...");
            if (blockBlob.Metadata.ContainsKey(ConfigSettings.JOBID_METADATA_NAME) && blockBlob.Metadata.ContainsKey(ConfigSettings.IMAGE_CONVERSION_MODE_METADATA_NAME) && blockBlob.Metadata.ContainsKey(ConfigSettings.IMAGE_SOURCE_METADATA_NAME))
            {
                log.LogInformation("[SUCCESS] job entry contains required metadata");

                string jobId = blockBlob.Metadata[ConfigSettings.JOBID_METADATA_NAME];

                string imageConversionMode = blockBlob.Metadata[ConfigSettings.IMAGE_CONVERSION_MODE_METADATA_NAME];

                string imageSource = blockBlob.Metadata[ConfigSettings.IMAGE_SOURCE_METADATA_NAME];

                log.LogInformation("[PENDING] Connecting to jobs table...");
                JobTable jobTable = new JobTable(log, ConfigSettings.IMAGEJOBS_PARTITIONKEY);
                log.LogInformation("[SUCCESS] Connected to Jobs Table");

                string imageResult = $"{Environment.GetEnvironmentVariable(ConfigSettings.STORAGE_DOMAIN_METADATA_NAME)}/{ConfigSettings.CONVERTED_IMAGES_CONTAINER_NAME}/{name}";

                JobEntity successJobEntity = JobEntity.New(jobId, imageConversionMode, JobStatusCodes.CONVERT_SUCCESS, JobStatusMessages.CONVERT_SUCCESS, imageSource, imageResult);

                log.LogInformation("[PENDING] Updating job entry with success status...");
                await jobTable.UpdateJobEntityStatus(successJobEntity);

                log.LogInformation("[SUCCESS] Job entry updated with success status");
            }
            else
            {
                log.LogError("The specified job does not contain the required metadata and cannot be updated.");
            }
        }
        public static async void Run([BlobTrigger(route, Connection = ConfigSettings.STORAGE_CONNECTIONSTRING_NAME)] Stream myBlob, string name, ILogger log)
        {
            log.LogInformation("[PENDING] Connecting to blob storage...");
            BlobStorage blobStorage = new BlobStorage();

            log.LogInformation("[SUCCESS] Connected to blob storage");

            string imageSourceURI = $"{Environment.GetEnvironmentVariable(ConfigSettings.STORAGE_DOMAIN_METADATA_NAME)}/{ConfigSettings.TO_SEPIA_CONTAINER_NAME}/{name}";

            string jobId = Guid.NewGuid().ToString();

            JobEntity initialJobEntity = JobEntity.New(jobId, ConversionModeNames.SEPIA, JobStatusCodes.IMAGE_OBTAINED, JobStatusMessages.IMAGE_OBTAINED, imageSourceURI, "");

            log.LogInformation("[PENDING] Adding initial job entry to table...");
            await Shared.UpdateJobTableWithStatus(log, initialJobEntity);

            log.LogInformation("[SUCCESS] Initial job entry added to table");

            string convertedBlobName = $"{Guid.NewGuid()}-{name}";

            try
            {
                log.LogInformation("[PENDING] Applying sepia filter to image...");
                MemoryStream convertedMemoryStream = ImageConverter.ConvertImageToSepia(myBlob);
                log.LogInformation("[SUCCESS] Applied sepia filter to image");

                JobEntity convertInProgressJobEntity = JobEntity.New(jobId, ConversionModeNames.SEPIA, JobStatusCodes.BEING_CONVERTED, JobStatusMessages.BEING_CONVERTED, imageSourceURI, "");

                log.LogInformation("[PENDING] Updating job status to conversion-in-progress");
                await Shared.UpdateJobTableWithStatus(log, convertInProgressJobEntity);

                log.LogInformation("[SUCCESS] Job status updated to conversion-in-progress");

                log.LogInformation("[PENDING] Uploading converted image to converted images container...");
                blobStorage.UploadConvertedImage(initialJobEntity, convertedBlobName, convertedMemoryStream);
                log.LogInformation("[SUCCESS] Converted image uploaded to converted images container");
            }
            catch (Exception e)
            {
                log.LogError("An error occured while converting the image");

                try
                {
                    log.LogInformation("[PENDING} Uploading original image to failed container...");
                    blobStorage.UploadFailedImage(initialJobEntity, convertedBlobName, myBlob);
                    log.LogInformation("[SUCCESS] Original image uploaded to failed container");
                }
                catch (Exception ex)
                {
                    log.LogError("Failed to upload image to failed container");
                }
            }
        }