added tests for recursive cdm entity loading and updated corresponding code