class SimpleProvenanceService implements ProvenanceService {

    @Override
    public Activity createActivity(ActivityConfig config) {
        Map<Class<? extends Activity>, OrmFactory<? extends Activity>> factoryMap = getActivityFactories();
        Activity activity = activityFactory.createNew(vf.createIRI(ACTIVITY_NAMESPACE + UUID.randomUUID()));
        for (Class<? extends Activity> type : config.getTypes()) {
            if (!factoryMap.containsKey(type)) {
                throw new IllegalStateException("No factory registered for type: " + type);
            }
            activity = factoryMap.get(type).createNew(activity.getResource(), activity.getModel());
        }
        activity.setWasAssociatedWith(Collections.singleton(config.getUser()));
        activity.setGenerated(config.getGeneratedEntities());
        addEntitiesToModel(config.getInvalidatedEntities(), activity.getModel());
        activity.setInvalidated(config.getInvalidatedEntities());
        addEntitiesToModel(config.getGeneratedEntities(), activity.getModel());
        activity.setUsed(config.getUsedEntities());
        addEntitiesToModel(config.getUsedEntities(), activity.getModel());
        return activity;
    }

}