function mergeFeatures(newFeature, existingFeature = {}) {
  const featureToReturn = { ...newFeature };

  if (existingFeature && existingFeature.name) {
    featureToReturn.name = existingFeature.name;
  }

  if (existingFeature && existingFeature.keep_history !== undefined) {
    featureToReturn.keep_history = existingFeature.keep_history;
  }

  return featureToReturn;
}
@description Merge feature attributes from existing with the new one.
It keeps 'name' and 'keep_history' attribute from existing.
@param {object} newFeature - Newly created feature.
@param {object} existingFeature - Already existing feature.
@returns {object} A new feature merged with existing one.
@example
mergeFeatures({ name: 'Default name' }, { name: 'Overriden name' })