this is wrong. This code is inside the EntityRepository, not the registry