Automatic serialization , if return type is class.