Refactored the use of providers for entities