On the role of the microstructure in the deformation of porous solids