A Multilayer Theory for Gas Sorption