function hasDeviceChanged(newDevice, existingDevice = {}) {
  const { features, params } = newDevice;
  const existingFeatures = existingDevice.features || [];
  const existingParams = existingDevice.params || [];

  let deviceChanged = existingFeatures.length !== features.length || existingParams.length !== params.length;
  let i = 0;
  while (!deviceChanged && features[i]) {
    deviceChanged = matchFeature(existingFeatures, features[i]) < 0;
    i += 1;
  }

  i = 0;
  while (!deviceChanged && params[i]) {
    deviceChanged = matchParam(existingParams, params[i]) < 0;
    i += 1;
  }

  return deviceChanged;
}
@description Compares both argument devices and check if any changes occurred on following attributes:
 - features: check for added or deleted features (based only on external_id)
 - params: check for added, updated or deleted (based on name and value).
@param {object} newDevice - New device.
@param {object} existingDevice - Existing device.
@returns {boolean} Indicates if the new device is different from the existing one.
@example
hasDeviceChanged({ features: [(3)], params: [ ... ]}, { features: [(0)], params: [ ... ]})