A social media post doesn’t have to sink your career.

Former New Yorker fact-checker Talia Lavin is the latest person to exit her job after a controversial tweet, after her June 18 post mistakenly suggesting that an Immigration and Customs Enforcement agent’s tattoo depicted a Nazi symbol drew outrage online. (Agent Justin Gaertner’s tattoo wasn’t the Nazis’ Iron Cross, as ICE later explained in a fiery response, but “the symbol for his platoon while he fought in Afghanistan.”) Lavin soon deleted her tweet and issued an explanation, but the damage was already done.

“To Justin Gaertner, I apologize, sincerely: all I saw in you was the photo ICE tweeted, and not the human being depicted inside it. It was uncharitable, and the hasty deletion doesn’t change that,” Lavin tweeted Saturday. “I’m sorry and I have voluntarily resigned after three years at the New Yorker.”

Lavin added on Twitter that she didn’t think it was “acceptable for a federal agency to target a private citizen for a good faith, hastily rectified error,” and said she “had become a weapon used to discredit my colleagues and the vital work they do holding power to account.”

“I just feel like I made a small mistake and it’s destroyed my life,” she told New York magazine’s The Cut.

Also read: CNN’s Jeffrey Lord is the latest person to be canned over a controversial tweet — here’s how to avoid the same fate

She’s not alone in seeing swift, unforgiving fallout after hitting “send” on a tweet: Pro-Trump commentator Jeffrey Lord lost his CNN job for tweeting the Nazi salute in an attempt to blast “fascist” ad boycotts. TV host Reza Aslan got canned by the same network for his anti-Trump tweets. Former “Glee” extra Nicole Crowther got the boot in 2011 after revealing plot spoilers on Twitter. Gilbert Gottfried lost his Aflac gig that year over his tasteless jokes about the Japanese tsunami. Roseanne Barr’s rebooted ABC show, meanwhile, was canceled after she fired off a racist tweet about former Obama adviser Valerie Jarrett.

Celebs and media personalities aren’t alone: 34% of employers say they’ve discovered content online that prompted them to reprimand or fire a worker, according to a 2017 CareerBuilder survey of 2,380 hiring and HR managers. And just over half say they use social media to research their employees.

But one online mistake doesn’t have to weigh you down for eternity. Take Octavia Nasr, a 20-year CNN veteran who served as senior editor for Middle East affairs. She was fired in 2010 after mass outrage over her expressing “respect” for Shiite cleric Grand Ayatollah Mohammed Hussein Fadlallah in a tweet following his death, though she later explained her point had been about his “contrarian and pioneering stand among Shia clerics” on women’s rights, despite his praise of attacks against Israel and anti-U.S. sentiments. The Atlanta-based journalist, 52, went on to launch her own firm, Bridges Media Consulting.

Here’s how to regroup and land another gig after you’ve been fired over an offensive, controversial or otherwise ill-advised post, according to Nasr and other experts:

Do your homework, Nasr told Moneyish, and understand who it is you’re applying to work for. “I think if you do an honest search, you’ll know for yourself that maybe you shouldn’t apply there,” she said. “If you put yourself in these people’s shoes, and you see how they’re going to see you, and you think that’s going to be a big deal, then don’t apply — or apply, and be ready to answer (their) questions.”

Also read: Here’s how to handle a social-media nightmare like Ted Cruz’s

Clean up your online image. Freshen your Twitter, Facebook and LinkedIn profiles with a new photo and updated info, Nasr said, and be active in sharing and posting around your professional subject area. “That’s your business card online,” she said. “People search for you — what are they going to see?” Get LinkedIn contacts to endorse you, she added, and consider publishing relevant posts on Medium or another platform.

Collect testimonials. Nasr says she gathered articles written in her support “from all different points of view.” “If you have this kind of support, use it to your advantage,” she said. “Say, ‘Yes, I was fired for this — but at the same time, look at all these outcries. Look at all the support that I was able to gain.’” If you were able to get a job somewhere else in the interim, she added, then highlight that “as a way to explain that what happened to you didn’t really affect your marketability or your appeal.”

Manage your references. When you separate from your company, HR consultant and Exaqueo CEO Susan LaMotte told Moneyish, ask how the reference process would go, and talk with an attorney and advisers on how to ask that question. Your company may ask you to sign a nondisparagement agreement, she said, and you may also want to reach an agreement on what the company can and can’t say about you. If you have any former coworkers who’d want to serve as a reference, LaMotte added, then advise them on how to approach the topic of your firing.

Face the elephant in the room. “I would be very clear about what happened,” Nasr said. “Be honest and be transparent. If you did something wrong, say it — ‘I did something wrong’ — and explain why you did it. Don’t blame it on Ambien (as Barr did). Just own it and move on.” LaMotte agreed, adding, “if it has a lot of attention; if it’s all over the media … it’s best to be proactive and address it.”

If your firing made headlines, career coach and writer Kathy Caprino said, you may even want to lead with it during an interview: “Look, let’s start with this because it’s probably on your mind. I did share a tweet that went viral, and I regret it. And I see my part in it, and I understand what I did, and I’m going to take different actions so that won’t happen again,” she suggested. “If you have any questions about that, let me know — but I really would love to talk about my skills and my expertise, and what I can contribute to this job.”

If you need to apologize, then apologize. “In my book, apology is a virtue,” Nasr said. “When you do something wrong, you apologize and you hope for the best. It might work; it might not work.” If you were fired for tweeting something particularly offensive or insensitive, LaMotte said, then talk about what you’ve done to understand your actions and better yourself — whether that’s therapy, a class or bias training.

If your interviewer doesn’t bring up your termination, you may still want to provide an explanation at the end of the interview. Give them a chance to exhaust all their questions for you, Nasr suggested, then say something like, “For transparency’s sake, I’d like to just put this out there” — just as an FYI. But if you’re applying for a job in a completely different industry and your firing feels unimportant or irrelevant, she said, there’s likely no need.