See https://ttlc.intuit.com/community/tax-credits-deductions/discussion/contractor-bankruptcy-deduct-as-...