A generalized polarizable continuum model for the study of heterogeneous dielectric environments