/// <summary>
        /// Constructs an instance of the workflow instance invoker.
        /// </summary>
        /// <param name="instance">The current workflow instance object.</param>
        /// <param name="instance">The Report that references the Workflow.</param>
        /// <param name="instanceStore">The durable instance store.</param>
        /// <param name="timeout">The default timeout.</param>
        /// <param name="reportId">A unique report identifier.</param>
        public WorkflowInstanceInvoker(WorkflowInstance instance, InstanceStore instanceStore, TimeSpan timeout)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            DefaultTimeout = timeout;

            _application = // create application and set handlers
                           new WorkflowApplication(instance.Deserialize())
            {
                Completed       = OnCompleted,
                InstanceStore   = instanceStore,
                PersistableIdle = OnPersistableIdle
            };

            // attach the workflow instance as an extension
            _application.Extensions.Add(instance);

            // Attach Claims Principal
            _application.Extensions.Add(ClaimsPrincipal.Current);

            // sync up durable instance id with store
            _instanceId = instance.DurableInstanceId;

            _isComplete = false;
            _isIdle     = false;
        }