public Collection<Entity<?>> convert(TemplateHashModelEx hash, String... ignore) {
   List<Entity<?>> entities = new LinkedList<Entity<?>>();
   List<String> ignoreList = Arrays.asList(ignore);
   TemplateCollectionModel keys;
   try {
     keys = hash.keys();
     for (TemplateModelIterator iterator = keys.iterator(); iterator.hasNext(); ) {
       TemplateModel model = iterator.next();
       String key = model.toString();
       if (!ignoreList.contains(key)) {
         entities.add(new SimpleEntityModel(key, hash.get(key).toString()));
       }
     }
     Collections.sort(entities, new EntityComparator());
     return entities;
   } catch (TemplateModelException e) {
     throw new RuntimeException(e);
   }
 }
 private static List<TemplateModel> readList(TemplateModel o) {
   try {
     ArrayList<TemplateModel> l = new ArrayList<TemplateModel>();
     if (o instanceof TemplateSequenceModel) {
       TemplateSequenceModel seq = (TemplateSequenceModel) o;
       for (int i = 0; i < seq.size(); i++) l.add(seq.get(i));
     } else if (o instanceof TemplateCollectionModel) {
       TemplateCollectionModel coll = (TemplateCollectionModel) o;
       TemplateModelIterator iter = coll.iterator();
       while (iter.hasNext()) l.add(iter.next());
     } else if (o instanceof TemplateBooleanModel) {
       l.add(o);
     } else if (o instanceof TemplateNumberModel) {
       l.add(o);
     } else if (o instanceof TemplateScalarModel) {
       l.add(o);
     }
     return l;
   } catch (TemplateModelException e) {
     throw new ServerException(BaseErrors.PLATFORM_SQL_TEMPLATE_ERROR, e);
   }
 }