code: protected List<Object> setRelationEntities(List enhanceEntities, Client client, EntityMetadata m)
      {
          // Enhance entities can contain or may not contain relation.
          // if it contain a relation means it is a child
          // if it does not then it means it is a parent.
          List<Object> result = new ArrayList<Object>();
          // Stack of objects. To be used for referring any similar object found
          // later.
          // This prevents infinite recursive loop and hence prevents stack
          // overflow.
          Map<Object, Object> relationStack = new HashMap<Object, Object>();
  
          if (enhanceEntities != null)
          {
              for (Object e : enhanceEntities)
              {
                  addToRelationStack(relationStack, e, m);
              }
          }
  
          if (enhanceEntities != null)
          {
              for (Object e : enhanceEntities)
              {
                  if (!(e instanceof EnhanceEntity))
                  {
                      e = new EnhanceEntity(e, PropertyAccessorHelper.getId(e, m), null);
                  }
                  EnhanceEntity ee = (EnhanceEntity) e;
                  result.add(getReader().recursivelyFindEntities(ee.getEntity(), ee.getRelations(), m,
                          persistenceDelegeator, false, relationStack));
  
              }
          }
  
          return result;
      }
docs: Sets the relation entities.
  
  @param enhanceEntities
  the enhance entities
  @param client
  the client
  @param m
  the m
  @return the list