refactoring products controller to respond to JSON
adding validation errors to form submissions