private static SolrInputDocument toSolr(DcsCollection col, ArchiveStore store)
      throws IOException {
    SolrInputDocument doc = new SolrInputDocument();

    add(doc, EntityField.ID, col.getId());
    add(doc, EntityField.TYPE, EntityTypeValue.COLLECTION.solrValue());

    if (col.getParent() != null) {
      add(doc, CollectionField.PARENT, col.getParent().getRef());
    }

    add(doc, CoreMetadataField.TITLE, col.getTitle());

    addMetadataSet(doc, col.getMetadata());
    addMetadataRefSet(doc, col.getMetadataRef(), EntityField.METADATA_REF, store);

    addResourceIdentifierSet(doc, col.getAlternateIds());

    add(doc, CoreMetadataField.TYPE, col.getType());

    addStrings(doc, col.getSubjects(), CoreMetadataField.SUBJECT);
    // addStrings(doc, col.getCreators(), CoreMetadataField.CREATOR);
    //        addCreatorSet(doc,col.getCreators());

    return doc;
  }
  protected static DcsEntity fromSolr(SolrDocument doc) throws IOException {
    String type = get(doc, EntityField.TYPE);
    if (type == null) {
      throw new IOException("Missing field: " + EntityField.TYPE.solrName());
    }

    if (type.equals(EntityTypeValue.COLLECTION.solrValue())) {
      return getCollection(doc);
    } else if (type.equals(EntityTypeValue.DELIVERABLE_UNIT.solrValue())) {
      return getDeliverableUnit(doc);
    } else if (type.equals(EntityTypeValue.FILE.solrValue())) {
      return getFile(doc);
    } else if (type.equals(EntityTypeValue.MANIFESTATION.solrValue())) {
      return getManifestation(doc);
    } else if (type.equals(EntityTypeValue.EVENT.solrValue())) {
      return getEvent(doc);
    } else {
      throw new IOException("Unknown type: " + type);
    }
  }