How to return an object from a function in Kotlin