A polarizable continuum approach for the study of heterogeneous dielectric environments