As soon as I exited my therapist’s office and checked my phone, I was bombarded by notifications. All my social profiles were assaulted with dozens of hateful comments during my one-hour therapy session.

The day before, I had an essay published on Cosmopolitan about how eliminating “obligation sex” had improved my relationship with my husband. Once the hate started piling on, I assumed, correctly, that men’s rights activists had found it. Since the essay was about sexual agency, it wasn’t surprising to me that men who spend their time trolling feminist content would be upset and angry with my declaration.

“I hope your husband cheats on you,” said one of the nicer of the messages in my Facebook inbox. Upset but not rattled, I put away my phone and drove home. But 20 minutes later, one of my Twitter followers sent me a link asking, “Have you seen this?” My heart sank. Staring back at me from the screen was my name and face on a tabloid site, along with the headline, “Meet the woman who REFUSES to have sex with her husband.”

I began to panic.

In the days and weeks that followed, I watched as numerous websites sensationalized my essay. Interview requests poured in, and my Twitter was a disaster area. I was going viral, but this wasn’t how I’d imagined it would happen.

As someone who tells stories for a living—specifically, my stories—watching the narrative I had spun so carefully slip further out of my control was devastating. I had to walk a very fine line between managing my virtual persona and making decisions in a frazzled emotional state, a state that could have easily derailed my career.

But thanks to crucial advice from my colleagues, I minimized the damage and took back my agency. If you ever find yourself in the face of unexpected—and potentially unwelcome—publicity from an article, it’s critical to manage your media presence and take care of your mental health. These tips can help.

Control your social presence

I was shocked to find photos of myself all over media outlets that picked up my story—photos I had not authorized them to use. But I quickly realized that they were my publicly available photos on Facebook, Twitter, and Instagram, so legally, those photos were fair game.

Ella Dawson, a freelance writer from New York City whose Women’s Health essay about living with herpes quickly went viral, said, “Think long and hard what parts of your life you want to make public and accessible.”

Dawson protects her privacy by carefully selecting which social media profiles she wants to be public and directing most fans to her public author page. She uses Twitter as her public platform but keeps her Instagram account private.

“Think about how you want to be accessible to people who like your work,” she said, “but also how you can respect your own boundaries.”

Suzannah Weiss, also from New York City, uses a security setting on her personal Facebook profile that allows her to approve posts she’s tagged in before they’re shared to her wall. Weiss had a Yahoo Beauty article about choosing not to shave her legs go viral, and since then, her Facebook safeguards have helped her keep a solid boundary between work and her personal life.

You can preemptively protect yourself by customizing the privacy settings on all your social media accounts. Additionally, decide whether you’d be comfortable if your current photos were shared across the Internet—if not, make them private or remove them altogether.

Don’t feed the trolls

This is a common refrain on the Internet and for good reason. I wanted my story to fade away as quickly as possible, so I chose not to tweet about any of the messages or attention. That way, outlets couldn’t mine my Twitter for new content—something others, such as infamous pharamceutical CEO Martin Shkreli, have ignored at their own peril.

I also decided not to respond to almost all of the hateful comments on the article itself. In the few times I did react, I made sure not to provoke. For example, after the man on Facebook messaged me privately to tell me he hoped my husband cheated on me, I just answered with, “You seem nice.” He never replied.

If you do respond to commenters, know that potential employers may be watching. Whatever you say on your public domains can have repercussions for your career—good and bad.

Be selective about interview requests

Once your story takes on a life of its own, you will probably receive interview requests from a variety of media outlets. But is all exposure good exposure? Not necessarily.

Crista Orenda, a Virginia writer, experienced life-altering virality last year when an interview about her “Orgasm Quest”—an attempt to regain her ability to climax after SSRIs caused her to become anorgasmic—received an incredible amount of unwanted media attention. But shortly after she rejected six tabloid-esque TV shows, the most intense attention began to fade.

“If you want it to end, reject interviews,” she suggested.

Likewise, Dawson encourages folks to trust their instincts. “I wish I’d known the advice that you should seize the moment is actually terrible advice. It led to me feeling guilty when I turned down invitations,” she said. “Be kind to yourself and if you feel uncomfortable, honor that. There will be other opportunities.”

Keep the facts straight

You may not be able to control how other outlets spin your story, but you do have control over the facts they’re reporting. For example, when a tabloid got a fact about Weiss’s story wrong, she emailed them to fix it.

For Dawson, correcting those factual errors made her feel more empowered at a time when she she had very little control over her own narrative. “I noticed that publications were changing bits and pieces of my story,” she explained. “It made me feel like my story was being taken away.”

You also should make sure to keep records when dealing with media outlets so you can have facts on hand in case you’re pushed to legal action. Orenda recommends conducting all interviews via text or email so there’s a written record, which will allow you to push back if you’re misrepresented.

Take a social break

Being inundated with attention can be exhausting. And when your narrative has been perverted beyond your control, watching the social media maelstrom will only add to your anxiety. Don’t be afraid to close your computer, put your phone in a drawer, and walk away.

If you find that the attention is becoming toxic, try asking a trusted friend to monitor your social accounts.

“One thing I did that really helped was to give a friend my Twitter login and asked them to delete all the notifications and block anyone saying mean things so I didn’t have to see any of it,” Weiss said.

Lean on a support network

It’s crucial to find a source of support during such a potentially isolating and terrifying experience.

“Going viral is a lonely experience because you don’t know many people who have gone through the same thing,” Dawson said. “I wish more people knew that it’s totally okay to be terrified. I cope by talking about things, so I kept bringing it up to friends, and people thought I was bragging. People mistook my panic at what was happening for arrogance.”

I found support in an online group of writer friends who helped me feel less alone during a time when many people in my life couldn’t empathize with what was happening. My therapist was also a great source of support.

Check in with friends and family

Your career is important, but your relationships are more important. Going viral can be tough for your friends and family, too, especially if the story is about them and reporters try to dig up additional dirt.

Take the time to check in with the people around you and encourage them to seek outside support if necessary.

Orenda found that the stress affected her relationships with her family. “My partner was resentful, not of the attention I was getting, but of how I dropped focus on him and us,” she said. She didn’t check in with him until some damage was already done. “We’ve recovered and learned new ways to communicate with each other, but it was hard.”

Connect with new fans and followers

The immediate aftermath of a viral story isn’t all bad. Not everyone on the Internet is part of the digital mob. You’re going to get more followers, including people who enjoyed your work and want to hear more from you.

Orenda thanked new readers and continued to express appreciation for their readership over time. I pinned a message to the top of my Facebook and Twitter profiles about how happy I was to have new followers as a result of my essay. I wanted everyone to know that I was grateful for their interest. I also took the time to respond to everyone who privately sent me a positive message, even if I just thanked them for reaching out or sharing their story.

Remember, you should ultimately use the exposure to advance your career and build a following. More importantly, seeing the positivity is an excellent way to rebuild your psyche and keep moving forward.