Added exception and also created base ORM class to hold db instance