         API.current()?.fetch(request, options: options) { [weak self] response in
             switch response {
             case .resource(let resource):
+                self?.hasMoreMessages = resource.count ?? 0 > 0
                 self?.handleMessages(
                     fetchingWith: resource.fetchMessagesFromRealm,
                     showing: resource.count,


    var query: String?
    private var isLoadingMoreMessages = false

    func searchMessages(withText text: String, completion: (() -> Void)? = nil) {
        guard let subscription = subscription else {

        API.current()?.fetch(request, options: options) { [weak self] response in
            switch response {
            case .resource(let resource):
                self?.hasMoreMessages = resource.count ?? 0 > 0
                self?.handleMessages(
                    fetchingWith: resource.fetchMessagesFromRealm,
                    showing: resource.count,
