Uncovering the mesoscale structure of the credit default swap market to improve portfolio risk modelling