/**********************************************************************************/
            // Executes node is passed if it is an activity
            private async Task ExecuteNode(PlanNodeDO currentNode, IUpdatableCrateStorage payloadStorage, ActivityExecutionMode mode)
            {
                var currentActivity = currentNode as ActivityDO;

                if (currentActivity == null)
                {
                    return;
                }

                _utilizationMonitoringService.TrackActivityExecution(currentActivity, _container);

                var payload = await _activity.Run(_uow, currentActivity, mode, _container);

                if (payload != null)
                {
                    var activityPayloadStroage = _crate.FromDto(payload.CrateStorage);

                    SyncPayload(activityPayloadStroage, payloadStorage, currentActivity.Id.ToString());
                }
            }
            /**********************************************************************************/
            // this method is for updating Container's payload with the payload that activity returns.
            // We store all information related to container exectution inside the OperationalStateCM crate.
            // Some of this information is internal like the call stack. Call stack is the replacement of the previously used Conatiner.CurrentPlanNodeId.
            // Ideally call stack and the related stuff should not be inside OperationalStateCM. It should be placed inside the container, not the payload.
            // But due to implementation details of activities like Loop, or TestAndBrach we have to store entire call stack inside the payload.
            // We can't allow activity to change frames sequence inside the call stack.
            // Allowing this is just like allowing one process to write into the memory of another without restrictions.
            // But once again, implementation details of the activities mentioned about requires us to grand some limited access to the stack frames: we allow activity to store some
            // custom data "binded" to the its own stack frame. But we still don't allow activity to rearrage stack frames, otherwise Hub will lose control over the execution.
            // The following methods exists to enfore described constrainsts: it allow to change  custom data, but do not allow rearranging the stack frames.
            // FR-3560 we also want to mark crates with the Id of activity that produced it and we don't want activities to break it
            private void SyncPayload(ICrateStorage activityPayloadStorage, IUpdatableCrateStorage containerStorage, string currentActivityId)
            {
                if (activityPayloadStorage == null)
                {
                    return;
                }
                //Save the info about crates that already existed in payload
                var containerCrateSources = containerStorage.Where(x => x.ManifestType.Id != (int)Fr8.Infrastructure.Data.Constants.MT.OperationalStatus)
                                            .ToDictionary(x => x.Id, x => x.SourceActivityId);

                // Update container payload with the payload returned from the activity.
                containerStorage.Replace(activityPayloadStorage);
                // Update source activity Id info for all crates and if it is a crate produced by current activity then mark it with its Id
                foreach (var crate in containerStorage.Where(x => x.ManifestType.Id != (int)Fr8.Infrastructure.Data.Constants.MT.OperationalStatus))
                {
                    string sourceActivityId;
                    crate.SourceActivityId = containerCrateSources.TryGetValue(crate.Id, out sourceActivityId) ? sourceActivityId : currentActivityId;
                }
                // get OperationalStateCM after update.
                _operationalState = GetOperationalState(containerStorage);

                //_operationalState.CallStack.TopFrame.LocalData - is the data activity wants to store within the stack frame
                // store this data in the variable
                var localData = _operationalState.CallStack.TopFrame?.LocalData;

                // and replace call stack wihtin OperationalStateCM with the call stack Hub is using for this exectuion session.
                _operationalState.CallStack = _callStack;

                // We are 100% call stack is correct and was not corrupted by the activity.
                // But now we lost the data that activity asked us to persist within the stack frame.
                // Restore this data.
                if (_callStack.Count > 0)
                {
                    _callStack.TopFrame.LocalData = localData;
                }
            }