@SuppressWarnings("unchecked")
  static Collection retrieveCollectionAsObject(Context context, String collection, String scope)
      throws Exception {
    Object obj = RetrievalUtils.retrieve(context, collection, scope);
    if (obj instanceof Collection) {
      return (Collection) obj;
    } else if (obj instanceof Map) {
      return ((Map) obj).values();
    } else {
      if (logger.isDebugEnabled()) {
        logger.debug("The object is not of type Collection.");
      }

      return Collections.EMPTY_LIST;
    }
  }
  @SuppressWarnings("unchecked")
  static Collection retrieveNestedCollection(Context context, String collection, String scope)
      throws Exception {
    String split[] = StringUtils.split(collection, ".");
    Object obj = RetrievalUtils.retrieve(context, split[0], scope);
    String collectionToFind = StringUtils.substringAfter(collection, ".");
    if (ExtremeUtils.isBeanPropertyReadable(obj, collectionToFind)) {
      obj = PropertyUtils.getProperty(obj, collectionToFind);
    }

    if (!(obj instanceof Collection)) {
      if (logger.isDebugEnabled()) {
        logger.debug("The object is not of type Collection.");
      }

      return Collections.EMPTY_LIST;
    }

    return (Collection) obj;
  }