move homepage logic in pagecontroller