private void StopWorkflows()
        {
            logger.LogVerbose("Stopping configured workflows");

            if (stoppedWorkflows.Count > 0)
            {
                throw new ValidationException("There are alredy stopped workflows, activate them first!");
            }

            List <WorkflowEntity> allWorkflows = processRepository.GetAllWorkflows().Where(p => p.WfType == WorkflowType.Definition && (p.WfCategory == WorkflowCategory.Workflow || p.WfCategory == WorkflowCategory.BusinessRule)).ToList();

            if (workflows == null)
            {
                workflows = allWorkflows.Select(p => p.Name).ToList();
            }

            if (workflows != null && workflows.Count > 0)
            {
                foreach (var item in workflows)
                {
                    WorkflowEntity wkflow = allWorkflows.FirstOrDefault(p => p.Name == item);
                    if (wkflow != null && wkflow.WfState == WorkflowState.Activated)
                    {
                        DeactivateWorkflow(wkflow);
                    }
                    else
                    {
                        logger.LogVerbose($"Workflows {item} does not exist or is already stopped");
                    }
                }
            }
        }