Added db query in controller