this whole thing is recurrent, can you refactor a $this->jsonResponse() ?