protected internal override object Execute(ICommandContext commandContext, IExecutionEntity execution)
        {
            if (variables is null || variables.Count == 0)
            {
                return(null);
            }

            if (isLocal)
            {
                foreach (string variableName in variables.Keys)
                {
                    execution.SetVariableLocal(variableName, variables[variableName], false);
                }
            }
            else
            {
                foreach (string variableName in variables.Keys)
                {
                    execution.SetVariable(variableName, variables[variableName], false);
                }
            }

            // ACT-1887: Force an update of the execution's revision to prevent
            // simultaneous inserts of the same
            // variable. If not, duplicate variables may occur since optimistic
            // locking doesn't work on inserts
            execution.ForceUpdate();

            return(null);
        }
        protected internal virtual void LockFirstParentScope(IExecutionEntity execution)
        {
            IExecutionEntityManager executionEntityManager = Context.CommandContext.ExecutionEntityManager;

            bool             found = false;
            IExecutionEntity parentScopeExecution = null;

            while (!found && execution is object && execution.ParentId is object)
            {
                parentScopeExecution = executionEntityManager.FindById <IExecutionEntity>(execution.ParentId);
                if (parentScopeExecution != null && parentScopeExecution.IsScope)
                {
                    found = true;
                }
                execution = parentScopeExecution;
            }

            parentScopeExecution.ForceUpdate();
        }