Add a group to the map's metadata section.
@param {Object} state The redux state.
@param {Object} action The action object.

@returns {Object} The new state object.
function addGroup(state, action) {
  const groups = state.metadata ? Object.assign({}, state.metadata[GROUPS_KEY]) : {};
  groups[action.id] = action.config;
  const metadata = {};
  metadata[GROUPS_KEY] = groups;
  return Object.assign({}, state, {
    metadata: Object.assign({}, state.metadata, metadata),
  });
}