public AlertDefinitionEntity mergeSource(Source source, AlertDefinitionEntity entity) {
    entity.setSourceType(source.getType());

    try {
      String sourceJson = m_gson.toJson(source);
      entity.setSource(sourceJson);
    } catch (Exception e) {
      LOG.error("Unable to serialize the alert definition source during merge", e);
      return null;
    }

    assignNewUUID(entity);

    return entity;
  }
Updates source and source type of <code>entity</code> from <code>source</code>.
Also updates UUID, which must be done for any change in to the entity for it
to take effect on the agents.

@return the updated entity to be persisted, or null if alert source cannot be serialized to JSON
ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionFactory.java