@POST
 @Path("/groups")
 @Consumes(APPLICATION_JSON)
 @Produces(APPLICATION_JSON)
 @ApiOperation(
     value = "Create a new group trigger",
     response = Trigger.class,
     notes = "Returns created GroupTrigger")
 @ApiResponses(
     value = {
       @ApiResponse(code = 200, message = "Success, Group Trigger Created"),
       @ApiResponse(code = 500, message = "Internal server error"),
       @ApiResponse(code = 400, message = "Bad Request/Invalid Parameters")
     })
 public Response createGroupTrigger(
     @ApiParam(value = "Trigger definition to be created", name = "groupTrigger", required = true)
         final Trigger groupTrigger) {
   try {
     if (null != groupTrigger) {
       if (isEmpty(groupTrigger.getId())) {
         groupTrigger.setId(Trigger.generateId());
       } else if (definitions.getTrigger(tenantId, groupTrigger.getId()) != null) {
         return ResponseUtil.badRequest("Trigger with ID [" + groupTrigger.getId() + "] exists.");
       }
       definitions.addGroupTrigger(tenantId, groupTrigger);
       log.debug("Group Trigger: " + groupTrigger.toString());
       return ResponseUtil.ok(groupTrigger);
     } else {
       return ResponseUtil.badRequest("Trigger is null");
     }
   } catch (Exception e) {
     log.debug(e.getMessage(), e);
     return ResponseUtil.internalError(e.getMessage());
   }
 }
  @POST
  @Path("/groups/members")
  @Consumes(APPLICATION_JSON)
  @Produces(APPLICATION_JSON)
  @ApiOperation(
      value = "Create a new member trigger for a parent trigger.",
      response = Trigger.class,
      notes = "Returns Member Trigger created if operation finished correctly")
  @ApiResponses(
      value = {
        @ApiResponse(code = 200, message = "Success, Member Trigger Created"),
        @ApiResponse(code = 500, message = "Internal server error"),
        @ApiResponse(code = 404, message = "Group trigger not found."),
        @ApiResponse(code = 400, message = "Bad Request/Invalid Parameters")
      })
  public Response createGroupMember(
      @ApiParam(
              value = "Group member trigger to be created",
              name = "groupMember",
              required = true) //
          final GroupMemberInfo groupMember) {
    try {
      if (null == groupMember) {
        return ResponseUtil.badRequest("MemberTrigger is null");
      }
      String groupId = groupMember.getGroupId();
      String memberName = groupMember.getMemberName();
      if (isEmpty(groupId)) {
        return ResponseUtil.badRequest("MemberTrigger groupId is null");
      }
      if (isEmpty(memberName)) {
        return ResponseUtil.badRequest("MemberTrigger memberName is null");
      }
      Trigger child =
          definitions.addMemberTrigger(
              tenantId,
              groupId,
              groupMember.getMemberId(),
              memberName,
              groupMember.getMemberContext(),
              groupMember.getDataIdMap());
      if (log.isDebugEnabled()) {
        log.debug("Child Trigger: " + child.toString());
      }
      return ResponseUtil.ok(child);

    } catch (NotFoundException e) {
      log.debug(e.getMessage(), e);
      return ResponseUtil.notFound(e.getMessage());
    } catch (Exception e) {
      log.debug(e.getMessage(), e);
      return ResponseUtil.internalError(e.getMessage());
    }
  }