@Transactional
  public void create(AlertGroupEntity group, boolean fireEvent) {

    entityManagerProvider.get().persist(group);

    // associate the group with all alert targets
    List<AlertTargetEntity> targets = findAllGlobalTargets();
    if (!targets.isEmpty()) {
      for (AlertTargetEntity target : targets) {
        group.addAlertTarget(target);
      }
      entityManagerProvider.get().merge(group);
    }
    if (fireEvent) {
      AlertGroupsUpdateEvent alertGroupsUpdateEvent = new AlertGroupsUpdateEvent(
          Collections.singletonList(new AlertGroupUpdate(group)),
          UpdateEventType.CREATE);
      STOMPUpdatePublisher.publish(alertGroupsUpdateEvent);
    }
  }
Persists a new alert group.

@param group the group to persist (not {@code null}).
@param fireEvent should alert group update event to be fired
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDispatchDAO.java