droitatedDB/src/main/java/org/droitateddb/EntityService.java
public void save(final Collection<E> data, final int maxDepth) {
        if (toggle == ValidationToggle.ON) {
            AccumulatedValidationResult validationResult = databaseValidator.validate(data, maxDepth);
            if (!validationResult.isValid()) {
                throw new InvalidEntityException(validationResult);
            }
        }

        SQLiteDatabase database = openDB();
        try {
            final DatabaseSaver databaseSaver = new DatabaseSaver(database, maxDepth);
            transactional(database, new DatabaseOperation<Void>() {
                @Override
                public Void execute() {
                    for (E object : data) {
                        databaseSaver.save(object);
                    }
                    return null;
                }
            });
        } finally {
            closeDB(database);
        }
    }
public void save(final Collection<E> data, final int maxDepth) {
        if (toggle == ValidationToggle.ON) {
            AccumulatedValidationResult validationResult = databaseValidator.validate(data, maxDepth);
            if (!validationResult.isValid()) {
                throw new InvalidEntityException(validationResult);
            }
        }

        SQLiteDatabase database = openDB();
        try {
            final DatabaseSaver databaseSaver = new DatabaseSaver(database, maxDepth);
            transactional(database, new DatabaseOperation<Void>() {
                @Override
                public Void execute() {
                    for (E object : data) {
                        databaseSaver.save(object);
                    }
                    return null;
                }
            });
        } finally {
            closeDB(database);
        }
    }
Stores all given {@link Entity}s in the {@link Collection} to the database. Associated objects will be saved to
the given maxDepth.<br>
maxDepth of 0 means that only the given {@link Entity} itself will be saved without associations.

@param data     {@link Entity} which should be stored
@param maxDepth The maximum depth of the associated objects which should also be saved.
@throws IllegalStateException                             When the {@link PrimaryKey} field and its value of the {@link Entity} could
not be determined
@throws org.droitateddb.validation.InvalidEntityException when at least one of the given entities is invalid.