code: public static Entity getSubEntityByRel(Entity entity, String... rel) {
          if(entity == null) {
              throw new IllegalArgumentException("entity cannot be null.");
          }
          if(ArrayUtils.isEmpty(rel)) {
              throw new IllegalArgumentException("rel cannot be null or empty");
          }
          List<Entity> entities = entity.getEntities();
          if (entities == null)
              return null;
          Entity ent = null;
          for (Entity e : entities) {
              if (ArrayUtils.isNotEmpty(e.getRel()) && ArrayUtils.toString(rel).equals(ArrayUtils.toString(e.getRel()))) {
                  ent = e;
                  break;
              }
          }
          return ent;
      }
docs: Retrieve a sub entity by its relationship.
  @param entity cannot be <code>null</code>.
  @param rel cannot be <code>null</code> or empty.
  @return the located entity or <code>null</code> if not found.