Introduce process function to process resources in batches.

Should implement #8