First step at re-organizing Recent.controller

Signed-off-by: emanuele <emanuele45@gmail.com>
Another round of moving things around in Recent.controller

Signed-off-by: emanuele <emanuele45@gmail.com>
Move out of Recent controller some temporary table creation

Signed-off-by: emanuele <emanuele45@gmail.com>
A broken query (CREATE TEMPORARY) and an undefined variable

Signed-off-by: emanuele <emanuele45@gmail.com>
Another query out of Recent controller

Signed-off-by: emanuele <emanuele45@gmail.com>
And that's it, no more queris into Recent controller

Signed-off-by: emanuele <emanuele45@gmail.com>