private async Task <WorkflowDefinitionListDto> CreateWorkflowDefinitionListItemModelAsync(
            ElsaWorkflowDefinitionVersion workflowDefinition)
        {
            var instances = await _workflowInstanceStore
                            .ListByDefinitionAsync(workflowDefinition.DefinitionId)
                            .ToListAsync();

            return(new WorkflowDefinitionListDto
            {
                WorkflowDefinition = workflowDefinition,
                AbortedCount = instances.Count(x => x.Status == WorkflowStatus.Aborted),
                FaultedCount = instances.Count(x => x.Status == WorkflowStatus.Faulted),
                FinishedCount = instances.Count(x => x.Status == WorkflowStatus.Finished),
                ExecutingCount = instances.Count(x => x.Status == WorkflowStatus.Executing),
            });
        }
 private WorkflowDefinitionVersion Map(ElsaWorkflowDefinitionVersion source) => ObjectMapper.Map <ElsaWorkflowDefinitionVersion, WorkflowDefinitionVersion>(source);