Pull out the creation of a response entity from controller to a utility class.