refactored code to use a request to get data from entity