the lines 89-96 are common to POST and GET, could we factorize this ?