A General Theory of Secularization