                 return
             }
 
-            let messagesCount = self.messagesQuery.count
-
             if modifications.count > 0 {
                 DispatchQueue.main.async {
                     let isAtBottom = self.chatLogIsAtBottom()

                return
            }

            if insertions.count > 0 {
                var newMessages: [Message] = []
                for insertion in insertions {
                    let newMessage = Message(value: self.messagesQuery[insertion])
                    newMessages.append(newMessage)
                }

                            var indexPathModifications: [Int] = []

                            for modified in modifications {
                                guard modified < messagesCount else { continue }

                                let message = Message(value: self.messagesQuery[modified])
                                let identifier = message.identifier
