Umbraco Forms & Hangfire workflow retry

Hi All,

I am trying to use hangfire to retrigger a workflow if it has failed.

I am getting an exception when it hits the line _workflowExecutionService.ExecuteWorkflows which I cannot get to the bottom of, any help would be greatly appreciated to solve this.

Value cannot be null. (Parameter 'key1')
   at Umbraco.Cms.Core.Collections.CompositeStringStringKey..ctor(String key1, String key2)
   at Umbraco.Cms.Infrastructure.PublishedCache.Property.CacheValues.For(String culture, String segment)
   at Umbraco.Cms.Infrastructure.PublishedCache.Property.GetValue(String culture, String segment)
   at Umbraco.Forms.Core.Services.PublishedContentPageService.GetPageElements(IPublishedContent content)
   at Umbraco.Forms.Core.Services.WorkflowExecutionService.ExecuteWorkflows(List`1 workflows, Record record, Form form, FormState state)
   at Umbraco.Forms.Core.Services.WorkflowExecutionService.ExecuteWorkflows(Record record, Form form, FormState state, Boolean editMode)
   at Projects.Core.Services.ScheduledTasks.Retry(PerformContext context) in C:\Repos\Projects (Umbraco 10)\Project.Core\Services\ScheduledTasks.cs:line 144

I have the code below:

   var transactionCompleted = _ledService.GetTransactionReference(failedTransaction.URC,
        failedTransaction.TransactionReference).Result;

    if (transactionCompleted == null)
    {
        var form = _formService.Get(failedTransaction.FormGuid);
        if (form != null)
        {
            var record = _recordStorage.GetRecordByUniqueId(failedTransaction.RecordGuid, form);

            if (record != null)
            {
                var umbracoContext = _umbracoContextFactory.EnsureUmbracoContext().UmbracoContext;
                context.WriteLine($"Retrying transaction submission: {record.UniqueId}");
                _logger.LogInformation($"Retrying transaction submission: {record.UniqueId}");
                _workflowExecutionService.ExecuteWorkflows(record, form, FormState.Submitted,
                    false);

                failedTransaction.TransactionAttempts++;
                _ledsDatabaseService.UpdateTransactionReference(failedTransaction);
                context.WriteLine($"Updated transaction: {failedTransaction.Id}");
                _logger.LogInformation($"Updated transaction: {failedTransaction.Id}");
            }
        }
    }
}