code: @Override
    public <T> List<T> remove(Collection<? extends T> batchToRemove, String collectionName) {
      if (null == batchToRemove) {
        throw new InvalidJsonDbApiUsageException("Null Object batch cannot be removed from DB");
      }
      CollectionMetaData cmd = cmdMap.get(collectionName);
      cmd.getCollectionLock().writeLock().lock();
      try {
        @SuppressWarnings("unchecked")
        Map<Object, T> collection = (Map<Object, T>) collectionsRef.get().get(collectionName);
        if (null == collection) {
          throw new InvalidJsonDbApiUsageException("Collection by name '" + collectionName + "' not found. Create collection first.");
        }
  
        Set<Object> removeIds = new HashSet<Object>();
  
        for (T o : batchToRemove) {
          Object id = Util.getIdForEntity(o, cmd.getIdAnnotatedFieldGetterMethod());
          if (collection.containsKey(id)) {
            removeIds.add(id);
          }
        }
  
        if(removeIds.size() < 1) {
          return null;
        }
  
        JsonWriter jw;
        try {
          jw = new JsonWriter(dbConfig, cmd, collectionName, fileObjectsRef.get().get(collectionName));
        } catch (IOException ioe) {
          logger.error("Failed to obtain writer for " + collectionName, ioe);
          throw new JsonDBException("Failed to save " + collectionName, ioe);
        }
        boolean substractResult = jw.removeFromJsonFile(collection, removeIds);
  
        List<T> removedObjects = null;
        if(substractResult) {
          removedObjects = new ArrayList<T>();
          for (Object id : removeIds) {
            // Don't need to clone it, this object no more exists in the collection
            removedObjects.add(collection.remove(id));
          }
        }
        return removedObjects;
      } finally {
        cmd.getCollectionLock().writeLock().unlock();
      }
    }
docs: /* (non-Javadoc)
  @see org.jsondb.JsonDBOperations#remove(java.util.Collection, java.lang.String)