         handle ActionTypes.REMOVE_ACCOUNT, (accountID) ->
             AppDispatcher.waitFor [AccountStore.dispatchToken]
             messages = @getMessagesByAccount accountID
-            _message = _message.withMutations (map) ->
+            _messages = _messages.withMutations (map) ->
                 messages.forEach (message) -> map.remove message.get 'id'
 
             @emit 'change'

    *
    * @return {Array}
    ###
    getMessagesByMailbox: (mailboxID, first, last) ->
        # sequences are lazy so we need .toOrderedMap() to actually execute it
        _message.filter (message) -> mailboxID in message.get('mailboxIDs')
        .toOrderedMap()
        .slice(first, last)

    getMessagesCountByMailbox: (mailboxID, first, last) ->
        # sequences are lazy so we need .toOrderedMap() to actually execute it
        _message.filter (message) -> mailboxID in message.get('mailboxIDs')
        .count()

    getMessagesByConversation: (messageID) ->
        idsToLook = [messageID]
        conversation = []
        while idToLook = idsToLook.pop()
            conversation.push @getByID idToLook
            temp = _message.filter (message) -> message.get('inReplyTo') is idToLook
            idsToLook = idsToLook.concat temp.map((item) -> item.get('id')).toArray()

        return conversation

    ###
        Public API
    ###
    getAll: -> return _messages

    getByID: (messageID) -> _messages.get(messageID) or null

    ###*
    * Get messages from account, with optional pagination
    *
    * @param {String} accountID
    * @param {Number} first     index of first message
