title: how to handle multiple return types in groovy Mehods?
body: <p>I have a need to have a method to return Id in case of success and list of errors in case of fail.
   ex code snippet:</p>
  
  <pre><code>def save = {
     def errors = []
      if(Employee.save(flush:true)){
        return Employee.id
      }else{
        errors.add("Can't be saved")
        return errors.
      }
  
     } 
  </code></pre>
  
  <p>In Service class
  ICalling 
    Employee.save() - .. so how to check if it is error or id that save method returns</p>
  
  <p>Any suggestions around would be appreciated.</p>