Fleshed out implementation of EntityFactory.