The customer isn’t always right.

So workers at the Manhattan eatery Fresh Kitchen learned earlier this month, when attorney Aaron Schlossberg unleashed a racist tirade and threatened to call federal immigration authorities after overhearing an employee and a customer speaking Spanish. (Schlossberg, who endured days of negative press and professional repercussions over his caught-on-camera rant, apologized a week later and insisted he wasn’t racist.)

“He got mad that they were speaking in Spanish and he started ranting, yelling, screaming. It seemed like he wanted attention,” Fresh Kitchen manager Hyunsik Kong told the New York Post following the incident. “He got furious, started to talk really angrily about it, I just let it go at first because I thought it wasn’t too much of a big deal … Then he started to scream and get a little bit too loud and I stepped up, and said, ‘You shouldn’t be doing this here.’” Kong ultimately asked the lawyer to leave the restaurant, he said.

Also read: How do you deal with bigotry from a boss?

Days earlier on the opposite coast, a barista at a Riverside, Calif. location of Coffee Bean & Tea Leaf refused to serve a customer who slung Islamophobic attacks at a niqab-wearing Muslim woman in the store. “The Coffee Bean & Tea Leaf is fully committed to ensuring the wellness and safety of its customers, team members and business,” the company later told Newsweek in a statement. “We have a zero-tolerance policy when it comes to discrimination of any kind, and have the right to refuse service to any person who makes customers or team members feel endangered in any way.”

While experts stress that every such situation carries its own specific circumstances and difficulties, here’s how they suggested employees deal with a customer or client’s racist, sexist or otherwise discriminatory comment:

Calm down. “There’s already a wall between you and the other person, and the wall is going to get taller if you start yelling,” Phyllis Hartman, founder of the human resources company PGHR Consulting, told Moneyish. Removing yourself from the situation might be the best course of action, said human resources and diversity expert Di Ann Sanchez, who suggested asking a coworker to temporarily take over, or telling the client you’ll call them back.

“I don’t want my employee to lash out and have the customers looking around or taking a video,” Sanchez said. “So really, they’ve got to get away from the situation. … Somebody’s going to get that on social media, and it’s going to come back to the company.”

Pausing for some deep breaths can also go a long way, added Pivot career coach and Bates College psychology lecturer Rebecca Fraser-Thill. “That pause alone may speak volumes to the individual,” she said.

Also read: What to do if you’re forced to toe the company line on a sexual harassment case

Consider talking to the offending person. The decision to engage is an individual one, Hartman stressed, based on situational factors, whether you have a business relationship with the person, whether you’re likely to see them again, and the chances they will actually listen to you. Calmly telling the person to stop the negative behavior could have a significant impact, she added, as they may not even realize they caused discomfort. “You call me sweetie all the time,” Hartman said by way of example. “I would appreciate you not using that anymore, because it makes me uncomfortable — whether you intended it or not.”

Keep in mind your company culture and training around situations like these, added Sanchez. Some companies may call for a more restrained response like, “I find those comments offensive, and I would appreciate (if) you did not refer to my” disability, color or national origin, she said. A more aggressive zero-tolerance policy, on the other hand, might direct employees to go a step further and ask the person to please stop.

Document the incident. Write down the date and time, along with exactly what happened, including what both the customer and employee said, Sanchez said, and immediately take it to your manager. “They do have a responsibility to protect you — that’s the law,” Hartman said. “An employer has to protect their employees from harassment, period.” She recommended informing human resources, as well, since they may have additional information your boss doesn’t. “HR isn’t perfect either, but if you go to two people, then you’ve got more backing than if you just go to one.”

Also read: Here’s what to do if you’ve been sexually harassed at work

If you’re dealing with a major, high-stakes client, Fraser-Thill said, you hopefully work for a company aligned with your values that will support you if you speak up — even if there are financial ramifications. If you don’t, she said, you may choose to “stay silent at cost to yourself” and keep your job security; on the flip side, you might decide to respectfully take a stand knowing that your job may be in jeopardy. But even if you decide to stay quiet in the moment, Fraser-Thill said, the incident “should always be mentioned to somebody right after that.”

“Even if you make the choice in the moment, ‘I can’t rock this boat,’ that doesn’t mean stay silent forever by any means,” she said.

Steer clear of deflecting with humor. Cracking a joke to defuse the tension “runs the danger of minimizing it and making them think that this is a funny situation, and it’s not,” said Fraser-Thill. “Because then they think that it’s OK in a joking way,” Sanchez added. “Even if you make a joke about it, and you come back in a light manner, they’re still going to think it’s OK. And they’ll do it again.”

Have a go-to response prepared. “As much as we’d like to think we’re not going to encounter people who are going to say comments like these, unfortunately it’s a reality of our world that there are individuals who think in these ways,” Fraser-Thill said. And since heightened emotions in the moment might preclude you from accessing your rational brain, she said, it can help to have an “I” statement — like “I’m uncomfortable when someone speaks like that, so please don’t do that around me” — ready in your pocket.

“It doesn’t have to be said in some horribly serious tone. It can be said in a way that’s not conversation-halting, and then move back into, ‘So we were discussing XYZ. Let’s move forward,’” she said. “Obviously if the person then continues to make comments like that, you’re going to have to figure out your next line of defense — but (for) most people, that would shut them down.”

If the person’s comment seemed borderline or ambiguous, trust your instincts. “It really does depend on you knowing what you feel comfortable with,” Fraser-Thill said. “When you have that gut feeling that something’s wrong, I’m a believer in trusting that.” It’s never a bad idea to tell your boss or mentor how and why you felt uncomfortable during an exchange with a client, and ask for their advice. “You shouldn’t ever be feeling in your workplace that you’re being put in situations where there’s any discomfort — beyond, obviously, that you’re working hard,” she said.