The Generalized Second Law of Thermodynamics in Cosmology