code: @Override
      public T save(final T t) {
          return inTransaction(new Callable<T>() {
              @Override
              public T call() throws Exception {
                  T attached = getAttached(t);
                  if (attached != null) {
                      // Update
                      entityManager.merge(t);
                  } else {
                      // New object
                      entityManager.persist(t);
                  }
                  return t;
              }
          });
      }
docs: Saves a given entity. Use the returned instance for further operations as the operation might have
  changed the entity instance completely.
  <p>
  This method is used to save a new entity or to update it.
  
  @param t the instance to save
  @return the saved entity