public static Action GetActionForState(this IAsyncStateMachine stateMachine, int state) { return(() => { stateMachine.SetState(state); stateMachine.MoveNext(); }); }