moved common method to resource