   # for each thread
   return threads.map (thread) ->
     # update messages list with filtering out given messageId.
-    thread.update 'messages', (messages) -> messages.filter (id) -> id isnt messageId
+    thread.update 'messages', (messages) -> messages.remove messageId
 
 
 ###*

  unless threads.has channelId
    threads = initThread threads, channelId

  threads = threads.update channelId, (thread) ->
    thread.setIn ['messages', messageId], messageId

  return threads


###*

  ###
  addNewThread: (threads, { channel }) ->

    unless threads.has channel.id
      return initThread threads, channel.id

    return threads


  ###*
