Hartree method for molecular polaritons