Add toArray() function for RequestContext