Use covariance to detect state class from task class. Better use optimistic locking to detect bugs in conflicting state changes