refatoring app and website controllers code