Two recent lawsuits involving tech giants Uber Technologies Inc., Alphabet Inc. and Facebook Inc. underscore the risk that companies may face when an employee walks out the door with trade secrets.

Both lawsuits highlight the question: How can in-house lawyers best protect trade secrets when employees leave?

In one case, video game maker ZeniMax Media Inc. sued Oculus and Facebook for misappropriation of trade secrets, among other allegations, in the U.S. District Court for the Northern District of Texas in Dallas. In the complaint, ZeniMax alleged that Oculus’ chief technology officer, John Carmack, “secretly and illegally copied thousands of documents containing ZeniMax’s intellectual property” and took them when he left the company. On Feb. 1, a jury hit Oculus with a $500 million verdict, which Oculus said in a statement it plans to appeal.

Close to 2,000 miles away, in the U.S. District Court for the Northern District of California in San Francisco, Alphabet subsidiary Waymo is going after Uber, alleging patent infringement and stolen trade secrets in connection with self-driving car technology. In a Feb. 23 complaint, Waymo claims that former manager Anthony Levandowski downloaded more than 14,000 confidential files and then formed his own self-driving car company called Otto, which Uber acquired in August 2016. Otto and Uber took this intellectual property, Waymo said in the complaint, to avoid the risk, time and expense involved in independently developing the technology.

Increased employee movement from one company to another is one reason companies should be thinking about loss of trade secrets, said Jeffrey Webb, a partner at Ropes & Gray. “One thing that we probably have more of than we did a decade or decades ago is employee mobility,” he said. “People feel less tied to their current employers and with that comes the potential for [employees] to take stuff with them.”

This is particularly true in California, where, with limited exceptions, noncompete agreements are not enforceable, said Mark Chandler, senior vice president, general counsel and chief compliance officer at Cisco Systems Inc. “The California principle that does not enforce noncompete agreements is vital … and differentiates Silicon Valley from other areas of the country,” he said. “But one of the implications is the expectation that when employees do move to a potentially competitive environment, the employee will not try to use the employer’s trade secrets.”

As for how to prevent employees from going to a competitor with trade secrets, one solution is to have loyal employees who don’t want to leave, Chandler said. Creating a workplace where employees want to stay, he explained, is the “best way” to protect against an employee taking trade secrets.

Still, employees may choose to leave, so there should also be education around the expectation that employees will not take trade secrets, Chandler said, adding that a company would also be wise to have internal controls so that access to confidential information is segmented. “By doing that, you limit the scope of what employees with bad intentions can do,” he said.

A very thorough offboarding process can also go a long way, said Sterling Miller, former general counsel at Travelocity and Sabre Corp. and now a lawyer at firm Hilgers Graben. This is “so that when employees leave, they are reminded of their obligations,” he said, and certain protective processes such as instantaneously terminating access to emails and other company systems are set into motion.

It’s equally important, according to Miller, for companies to identify their trade secrets, so they can maintain the legal protection. “There are probably companies out there that think they are protected but would be in a bad place if an employee walked out the door with the crown jewels,” he said. “You need to act as a company as though things are trade secrets and keep them secret every day,” he said, which can include cataloging to know what should be guarded, labeling documents as trade secrets and using nondisclosure agreements with valuable information shared outside the company.

Miller said that the in-house legal department is “probably the group that should take the lead” on trade secret protection and should have a plan in place to be able to react quickly if there’s trouble.

“If someone walks out the door with trade secrets, [in-house counsel] should already know who to call to shut off access to certain systems and whether there are outside firms on standby who can help,” he offered. “This is going to save a tremendous amount of time and anxiety.”