Fix for #16 - case classes defined in methods cause error

Updated as per discussion of issue 16 - Fixes bug with case classes defined in method body.  Fixes code generation for play framework.