A slightly cleaner formulation of buildMultipart.