code: @SuppressWarnings("unchecked")
  	protected <ID extends Serializable> ID[] toListOfIds(Collection<? extends PersistenceEntity> entities, ID[] idsType) {
  		List<ID> ids = new ArrayList<>();
  		for (PersistenceEntity entity : entities) {
  			ids.add((ID) entity.getId());
  		}
  		return (ID[]) ids.toArray(idsType);
  	}
docs: Creates an array of Ids (pks) from a list of entities.
  It is useful when working with `in clauses` on DeltaSpike criteria
  because the API only support primitive arrays.
  
  @param entities list of entities to create
  @param idsType the type of the pk list, e.g new Long[0]
  
  @return primitive array containing entities pks.