public void Run()
            {
                Guid id;

                Guid.TryParse(DataTransferObject.ParentInstanceID, out id);
                ID          = DataTransferObject.ResourceID;
                ParentID    = DataTransferObject.ParentID;
                WorkspaceID = DataTransferObject.WorkspaceID;

                // handle queuing
                WaitForSlot();

                // abort the execution - no space at the inn
                if (!ExecutableServiceRepository.Instance.DoesQueueHaveSpace())
                {
                    _instance.Abort();
                }
                else
                {
                    ExecutableServiceRepository.Instance.Add(this);
                    // here is space at the inn ;)
                    var wfappUtils = new WfApplicationUtils();

                    if (DataTransferObject.IsDebugMode())
                    {
                        ErrorResultTO invokeErrors;
                        wfappUtils.DispatchDebugState(DataTransferObject, StateType.Start, AllErrors.HasErrors(), AllErrors.MakeDisplayReady(), out invokeErrors, null, true);
                        AllErrors.MergeErrors(invokeErrors);
                    }

                    _previousNumberOfSteps           = DataTransferObject.NumberOfSteps;
                    DataTransferObject.NumberOfSteps = 0;
                    _instance.Run();
                }
            }
            private void OnCompleted(WorkflowApplicationCompletedEventArgs args)
            {
                _result = args.GetInstanceExtensions <IDSFDataObject>().ToList().First();
                IDictionary <string, object> outputs = args.Outputs;

                try
                {
                    if (!_isDebug)
                    {
                        // Travis.Frisinger : 19.10.2012 - Duplicated Recordset Data Bug 6038

                        object parentId;

                        outputs.TryGetValue("ParentWorkflowInstanceId", out parentId);

                        parentId = _result.ParentWorkflowInstanceId;

                        object parentServiceName;
                        outputs.TryGetValue("ParentServiceName", out parentServiceName);

                        var parentServiceNameStr = string.IsNullOrEmpty(_result.ParentServiceName) ? string.Empty : _result.ParentServiceName;

                        if (!string.IsNullOrEmpty(parentServiceNameStr) && Guid.TryParse(parentId.ToString(), out _parentWorkflowInstanceID))
                        {
                            if (_parentWorkflowInstanceID != _currentInstanceID)
                            {
                                // BUG 7850 - TWR - 2013.03.11 - ResourceCatalog refactor
                                var services = ResourceCatalog.Instance.GetDynamicObjects <DynamicServiceObjectBase>(_workspace.ID, parentServiceNameStr);
                                if (services != null && services.Count > 0)
                                {
                                    var service = services[0] as DynamicService;
                                    if (service != null)
                                    {
                                        _currentInstanceID = _parentWorkflowInstanceID;

                                        var actionSet = service.Actions;

                                        if (_result.WorkflowResumeable)
                                        {
                                            var serviceAction = actionSet.First();
                                            PooledServiceActivity wfActivity = serviceAction.PopActivity();

                                            try
                                            {
                                                ErrorResultTO invokeErrors;
                                                _result = _owner.InvokeWorkflow(wfActivity.Value, _result, _executionExtensions, _parentWorkflowInstanceID, _workspace, "dsfResumption", out invokeErrors);
                                                // attach any execution errors
                                                if (AllErrors != null)
                                                {
                                                    AllErrors.MergeErrors(invokeErrors);
                                                }
                                            }
                                            finally
                                            {
                                                serviceAction.PushActivity(wfActivity);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Dev2Logger.Log.Error(ex);
                    ExecutionStatusCallbackDispatcher.Instance.Post(_result.ExecutionCallbackID, ExecutionStatusCallbackMessageType.ErrorCallback);
                }
                finally
                {
                    try
                    {
                        if (_waitHandle != null)
                        {
                            _waitHandle.Set();
                        }
                        ExecutableServiceRepository.Instance.Remove(this);
                        if (DataTransferObject != null)
                        {
                            DataTransferObject.NumberOfSteps = _previousNumberOfSteps;
                        }
                    }
                    catch (Exception e)
                    {
                        // Best effort ;)
                        Dev2Logger.Log.Error(e);
                    }
                }


                // force a throw to kill the engine ;)
                if (args.TerminationException != null)
                {
                    _instance.Terminate("Force Terminate", new TimeSpan(0, 0, 1, 0));
                }

                // Not compatable with run.Dispose()
            }