refactor products controller for json and html responses