Generic method to check if data is there or not