code: @Override
      public final void add(final V entity) {
  
          checkNotNull(entity, "Received a null pointer as the entity");
  
          if ((entity.getId() == null) || (entity.getId() < 0)) {
              // No ID has been assigned
              // It is a new entity
              getEntityManager().persist(entity);
          } else {
              // ID already assigned
              // It is an existing entity
              getEntityManager().merge(entity);
          }
      }
docs: Adds an entity to the repository, or updates it if it already exists.
  <p>
  Note that both the {@code add} and the {@link #update(PersistenceEntity)
  update} methods work the same. If the entity does not exist it will be
  added, but if it already exists then it will be updated.
  <p>
  If the entity is to be updated, then the update query received on the
  constructor will be used.
  <p>
  If it is inserted, a query generated from the data received by the
  constructor will be used.
  
  @param entity
  the entity to add