private List<AlertDefinitionEntity> getDefinitionsForMerge(List<AlertDefinition> definitions, long clusterId,
                                                             Map<String, AlertDefinitionEntity> mappedEntities ) {
    List<AlertDefinitionEntity> definitionsForMerge = new ArrayList<>();

    for (AlertDefinition definition: definitions) {
      AlertDefinitionEntity entity = mappedEntities.get(definition.getName());

      // no entity means this is new; create a new entity
      if (null == entity) {
        entity = alertDefinitionFactory.coerce(clusterId, definition);
        definitionsForMerge.add(entity);
      }
    }
    return definitionsForMerge;
  }
Returns new definitions for the merge

@param definitions List of the definitions
@param clusterId Cluster ID
@param mappedEntities Mapped entities
@return Entities to merge
ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java