move process helper function into pgrest