toJSON handles nested models