merge(source, entities, keyPropName = 'id') {
    return {
      byKey: {
        ...source.byKey,
        ...entities.reduce((acc, entity) => {
          acc[entity[keyPropName]] = entity;
          return acc;
        }, {})
      },
      keys: [
        ...new Set(
          entities
            .map(entity => entity[keyPropName])
            .filter(key => !source.keys.includes(key))
            .concat(source.keys)
        )
      ]
    };
  }
Merge given entities into given map.

@param {object} source
@param {array} entities
@return {object}