A generic unified model for the IceCube neutrinos and the ultra-high energy cosmic rays in the photomeson production scenario