public void UpdateState(FlowNodeInstance instance, ActivityStates state, string message = null)
        {
            var evt = new ActivityStateUpdatedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, instance.EltId, state, message, DateTime.UtcNow);

            Handle(evt);
            DomainEvents.Add(evt);
        }
        private void Handle(ActivityStateUpdatedEvent evt)
        {
            var instance = GetInstance(evt.FlowNodeInstanceId);

            instance.UpdateState(evt.State, evt.UpdateDateTime, evt.Message);
            Version        = evt.Version;
            UpdateDateTime = evt.UpdateDateTime;
        }