function addMessage(state, _ref) {
	  var message = _ref.message;

	  var msg = toImmutable(message);
	  var threadID = msg.get("threadID");

	  return state.withMutations(function (threads) {
	    // use standard ImmutableJS methods to transform state when handling an action
	    if (!threads.has(threadID)) {
	      threads.set(threadID, toImmutable({
	        threadID: threadID,
	        threadName: msg.get("threadName"),
	        messages: toImmutable([]) }));
	    }

	    // push new message into thread and sort by message timestamp
	    threads.update(threadID, function (thread) {
	      var sortedMessages = thread.get("messages").push(msg).sortBy(function (msg) {
	        return msg.get("timestamp");
	      });

	      return thread.set("messages", sortedMessages);
	    });
	  });
	}
@param {Immutable.Map}
@param {Object} payload
@param {Message} payload.message