Due the performance issues I have to refactor the following code to avoid using the raw numbers in generated queries:
override fun getMessages(chatId: Long, count