base code for every resource