code: @SuppressWarnings("unchecked")
    public <E> List<E> update(List<E> entities) {
      if (entities == null || entities.isEmpty()) {
        return new ArrayList<>();
      }
      try {
        Class<E> entityClass = (Class<E>) entities.get(0).getClass();
        entityManager.executeEntityListeners(CallbackType.PRE_UPDATE, entities);
        Intent intent = (nativeWriter instanceof Batch) ? Intent.BATCH_UPDATE : Intent.UPDATE;
        Entity[] nativeEntities = toNativeEntities(entities, entityManager, intent);
        nativeWriter.update(nativeEntities);
        List<E> updatedEntities = toEntities(entityClass, nativeEntities);
        entityManager.executeEntityListeners(CallbackType.POST_UPDATE, updatedEntities);
        return updatedEntities;
      } catch (DatastoreException exp) {
        throw DatastoreUtils.wrap(exp);
      }
    }
docs: Updates the given list of entities in the Cloud Datastore.
  
  @param entities
  the entities to update. The passed in entities must have their ID set for the update
  to work.
  @return the updated entities
  @throws EntityManagerException
  if any error occurs while inserting.