(CNN) California attorney Keith M. Davidson drafted a confidential contract in 2012 for a client trying to get cash for a secretly recorded video of pro wrestler Hulk Hogan having sex with a friend's wife.

The ensuing deal resulted in an extortion allegation, an FBI sting and Davidson subsequently claiming he would invoke his Fifth Amendment right against self-incrimination if called to testify about the matter. Davidson was questioned by the FBI, but never arrested or charged with a crime.

Years later, Davidson used a contract nearly identical to the one he'd used in the Hogan case for another client: Stormy Daniels.

That's because he wrote them both, according to a source familiar with the matter.

In the Hogan case it was to keep a sex tape from being sold to the press. In the Daniels case it was to keep her quiet and force her to hand over any text messages, or other evidence of an alleged affair with Donald Trump. No evidence of the affair has ever been publicly released.

The documents share full paragraphs of identical information, with changes to the parties involved, the amount paid, and some other details.

Davidson also wrote the contract between Republican fundraiser Elliott Broidy and a former Playboy model who claims Broidy impregnated her, said the source, who asked not to be identified due to an ongoing investigation regarding the Daniels' deal.

In all three instances, the source said, Davidson drafted the agreements even though it was the other side that was paying for silence or nondisclosure. It's the opposite of how such matters are typically handled, according to legal experts.

"I think that's not being a good lawyer," University of Southern California law professor Robert Rasmussen told CNN. "As the attorney representing a client who wants to keep someone from talking you want to make sure that it's an airtight agreement. If the other side writes it, it could be sloppy. They have an incentive to write something that makes it easier to get out of."

Judd Burstein, a New York City civil litigator with a long list of high-profile clients, including at one time Donald Trump, was more blunt:

"Any attorney will tell you, you don't let the side you are trying to silence write the contract," Burstein said. "It is generally just not done."

In a profile on Davidson earlier this month, The Smoking Gun noted Davidson used a template for his settlement deals, including the one he did for Daniels.

JUST WATCHED The cases that bind Cohen, Davidson Replay More Videos ... MUST WATCH The cases that bind Cohen, Davidson 02:51

In the cases involving Daniels and Broidy, Davidson's opposing counsel was Michael D. Cohen, President Trump's longtime personal attorney. The contracts used in both cases used the now famous pseudonyms David Dennison and Peggy Peterson to disguise the true identities of the parties involved, according to the source who has seen both agreements.

Dave Wedge, a spokesman for Davidson, declined to provide a detailed characterization of his role in either case he worked on with Cohen.

"Attorney Davidson cannot comment on these matters due to the constraints of attorney-client privilege," Wedge said in a prepared statement. "Generally speaking, agreements such as these can be drawn up by either side and are frequently edited by both sides as part of the negotiation process."

Federal agents raided Cohen's office , home and hotel room earlier this month and seized his computer, phone and legal documents. Among the information agents sought were records pertaining to the $130,000 Cohen has acknowledged paying Daniels in exchange for keeping quiet about an alleged sexual encounter with Trump more than a decade ago.

Agents also seized recorded telephone calls between Cohen and Davidson, a source told CNN. Davidson said through a spokesman last week that he has provided federal investigators "certain limited electronic information" and intends to cooperate to the full extent possible under the law.

Cohen has not responded to requests for comment.

Cohen's lawyer stated in federal court in New York that Cohen has only three clients regarding legal matters: Trump, Broidy and Fox News host Sean Hannity. Hannity said he sought Cohen's advice on real estate, but had never paid him any legal fees and that their dealings never involved a third party. Cohen has long been described as a "fixer" for Trump, but relatively little is known about what exactly that title entails.

Davidson might be able to provide some answers.

The Beverly Hills, California, attorney has intersected with Cohen on at least five matters in recent years, CNN found.

Cohen referred at least two clients to Davidson, according to the source, including a strange case involving a GoFundMe account a Trump supporter set up for a homeless woman who was trying to protect Donald Trump's star on the Hollywood Walk of Fame from vandalism. When a homeless advocate allegedly ran off with the money, Davidson helped the Trump supporter by filing a lawsuit in an effort to reclaim the funds.

The source said Davidson drafted two settlement deals involving Daniels and Trump in the weeks prior to the 2016 election. The first deal fell apart after Cohen failed to pay the $130,000 Daniels was demanding to stay quiet, said a source familiar with the matter.

Documents CNN has reviewed show the second time around, Cohen provided the money for the deal two days in advance of the contract being signed.

It was wired to a client trust account Davidson held at City National Bank in Los Angeles.

Davidson said in an interview with CNN that the transaction raised red flags at his bank even before the scandal became public. He recalled receiving either an "email inquiry" or a "very brief phone call" from the bank, he said.

He said he had never received such an inquiry before.

In 2017, Davidson came to represent a former Playboy model who said she was impregnated by Broidy, then the deputy finance chairman of the Republican National Committee.

Cohen represented Broidy, who agreed to pay the woman $1.6 million for undisclosed "injuries" and to stay quiet about the deal.

Again, it was Davidson who drafted the contract.

Cohen assured Broidy that he was "very experienced" in handling such matters, according to another source familiar with the deal.

Broidy assumed that Cohen "must have known what he was doing," said the source, who is not authorized to speak publicly about the matter. "He left it in the hands of Michael Cohen to write."

After the story published, Michael Avenatti, Stormy Daniels' current lawyer, sent a comment saying, "Any suggestion that Michael Cohen was not actively involved in the negotiation and drafting of the NDA for Ms. Daniels is patently false. He has already admitted as much."