code: public Instance updateInDB(final Instance _instance,
                                 final String _typeName)
      {
          Instance ret = null;
          try {
              final long typeID = _instance.getId();
              final long progID = getProgID(_typeName);
  
              final QueryBuilder queryBldr = new QueryBuilder(Type.get(this.event.getName()));
              queryBldr.addWhereAttrEqValue("Abstract", typeID);
              queryBldr.addWhereAttrEqValue("Name", this.name);
              final InstanceQuery query = queryBldr.getQuery();
              query.executeWithoutAccessCheck();
  
              final Update update;
              if (query.next()) {
                  update = new Update(query.getCurrentValue());
              } else {
                  update = new Insert(this.event.getName());
                  update.add("Abstract", typeID);
                  update.add("IndexPosition", this.index);
                  update.add("Name", this.name);
              }
              update.add("JavaProg", progID);
              update.add("Method", this.method);
              update.executeWithoutAccessCheck();
  
              ret = update.getInstance();
              update.close();
          } catch (final EFapsException e) {
              Event.LOG.error("updateInDB(Instance, String)", e);
              //CHECKSTYLE:OFF
          } catch (final Exception e) {
            //CHECKSTYLE:ON
              Event.LOG.error("updateInDB(Instance, String)", e);
          }
          return ret;
      }
docs: For given type defined with the instance parameter, this trigger is
  searched by typeID and index position. If the trigger exists, the
  trigger is updated. Otherwise the trigger is created.
  
  @param _instance   type instance to update with this attribute
  @param _typeName   name of the type to update
  @return Instance of the updated or inserted Trigger, null in case of
  error