Improve sample code
Fix UnionCase mapping problem