Or you can simply keep the planets you want and can keep and then destroy the rest denying them to the enemy...
Selling, of course, gets rid of them, too, but usually your coffers are already overflowing so destroying gives better value. Well, techs are nice, of course, if they have anything available.