Cosmology of Self-Gravitating Media