Add checks in controllers

put this 3 lines above in special util function in base controller