don't waste your time trying to brush it out!
stick a sheet of polythene between carpet and underlay, apply spotter/solvent/whatever and extract as normal. dry vac might help beforehand, depending on what's loose and what's not. Remove polythene after, otherwise moisture can't travel up/down and could cause probs down the line.
advise customer that if the carpet still has good number of years left in it, to replace the underlay. Thias will help the carpet last, when the underlay is crushed it's like theyre crushing the carpet straight onto the subfloor which wears it out quicker.
most don't go for this, which is the reason they had it cleaned in the first place rather than replaced it!