Rather than despair -- and clearly rather than pay the capital gains tax on the profit he anticipated on the sale of his principal residence -- he decided to sell the house to a wholly-owned subchapter S corporation that he had created .