private Task <FCluster> BuildFlow(UiFlow flow)
        {
            var cluster     = new FCluster(flow.FlowTypeId.ToUpper());
            var contextData = flow.CurrentState.ContextData;



            var nodes = flow.ScreenConfigurations.Select(x =>
            {
                var screenName         = (ScreenName)x.ScreenName;
                var isCurrentStep      = contextData.CurrentScreenStep.Equals(screenName);
                var alreadyExecuted    = contextData.EventsLog.Any(e => e.FromStep.Equals(screenName));
                FNode.FNodeColor color = isCurrentStep
                                        ? FNode.FNodeColor.Blue
                                        : alreadyExecuted
                                                ? FNode.FNodeColor.Green
                                                : FNode.FNodeColor.Gray;

                return(cluster.AddNode(new FNode(x.ScreenName, color)
                {
                    Thickness = isCurrentStep ? 3 : alreadyExecuted ? 2 : 1
                }));
            }).ToDictionary(x => x.Label, x => x);

            foreach (var step in flow.ScreenConfigurations)
            {
                var screenName = (ScreenName)step.ScreenName;
                var node       = nodes[step.ScreenName];
                foreach (var screenTransition in step.Transitions)
                {
                    if (nodes.ContainsKey(screenTransition.DestinationScreen))
                    {
                        var dest          = nodes[screenTransition.DestinationScreen];
                        var edge          = node.AddEdge(dest, screenTransition.DisplayName);
                        var timesExecuted = contextData.EventsLog.Count(x =>
                                                                        x.FromStep == screenName && x.ToStep == dest.Label &&
                                                                        x.Event == (ScreenEvent)screenTransition.EventName);
                        edge.Thickness = timesExecuted == 0 ? 1 : 3;
                        const int maxDash = 7;
                        edge.Dash = timesExecuted >= 1
                                                        ? (Math.Max(maxDash - timesExecuted, 0)).ToString()
                                                        : maxDash.ToString();
                        edge.ToolTip = $"Times= {timesExecuted}";
                    }
                }
            }

            return(Task.FromResult(cluster));
        }
        private async Task <FCluster> AddContainerStep(UiFlow flow, FCluster flowCluster)
        {
            var result = flowCluster;

            if (flow.CurrentState.ContextData.IsInContainer())
            {
                var containerFlow = await ResolveUiFlowFromHandler(flow.CurrentState.ContextData.ContainerFlowHandler);

                result = new FCluster(
                    $"{containerFlow.FlowTypeId.ToUpper()}.{containerFlow.CurrentState.ContextData.CurrentScreenStep}");
                result.AddNode(flowCluster);
            }

            return(result);
        }