Added two helper methods, one for 301 response and another for json response