Efficient state machine for .NET with both synchronous and asynchronous support