There was a time in 2017 when John Lynch, a Fox Sports broadcaster, couldn't get a good night's sleep. Something was gnawing at him. His mind was stuck on something, but he couldn't quite figure out what it was. The sleepless nights were interrupting his vacation.

Then, one morning, it hit him.

A few days earlier, Lynch had spoken to Kyle Shanahan on the phone, congratulating the Atlanta Falcons offensive coordinator on a great Divisional Round playoff victory. Like everyone else, he had heard the rumors. It sounded like Shanahan was on his way to the San Francisco 49ers to be their head coach as soon as the Falcons' playoff run was complete. Lynch wished Shanahan luck in the NFC Championship Game, and as the conversation ended, Shanahan told the Fox Sports broadcaster that he just hoped to find a general manager to pair up with in San Francisco.

That's what had caused the sleepless nights.

Lynch had always imagined that, had he jumped into an NFL executive role, it would be working for his friend, John Elway, the general manager of the Denver Broncos. He had helped the organization in a couple of its draft preparations. Or maybe even a job with the San Diego Chargers, because that's where Lynch was from, and that's where he wanted to live.

But there was something about the idea of working with Shanahan in San Francisco that just seemed like a good fit. So Lynch called Shanahan back and threw his name into the 49ers general manager hat.

"Why would you do that?" Shanahan asked Lynch. "You have a great job."

Thirty minutes later, Shanahan had 49ers CEO Jed York on the phone, and Lynch was headed to the Bay Area to discuss the possibility of what would soon become a reality — Lynch becoming San Francisco's general manager.

For Shanahan, becoming the 49ers head coach was an exciting opportunity. It was the right opportunity. His father, Mike Shanahan, had helped lead the organization to a Super Bowl victory as the team's offensive coordinator. Kyle Shanahan was a kid at the time, but those memories stuck with him.

Lynch had links to the 49ers, too, though. He was recruited to Stanford by head coach Dennis Green, who had just finished a stint with San Francisco as the team's wide receivers coach under the legendary Bill Walsh. After three seasons, Green left Stanford to become the head coach of the Minnesota Vikings. His replacement at Stanford was Walsh.

It was Walsh who convinced Lynch not to leave football for baseball. The backup quarterback at Stanford was transitioning to safety and wasn't sure about his football future. Walsh told him he could be a Pro Bowl safety in the NFL.

In 1993, Walsh recommended Lynch to Sam Wyche, the head coach of the Tampa Bay Buccaneers. Wyche drafted Lynch in the third round, and the rest is history.

"There's so many ties for me," Lynch told Peter King of NBC Sports this week on the Peter King Podcast. "[The 49ers were] just kind of the standard-bearer of a first-class organization, and everyone knew it. I went to school at Stanford when they were winning all their championships.

"I just said, 'What a cool opportunity.' A coach who I believe in, in Kyle. And Kyle was just a coordinator, but I played for his dad, which gave me some insight into the pedigree that Kyle had. And then just became fascinated with Kyle as I was calling games. I thought he was a cut above in terms of the way he was calling offense, and designing offense, and the versatility of his offense."

Lynch explained that he and Shanahan would become fascinated with one another while talking football in production meetings for the games Lynch was covering for Fox Sports.

What does Lynch see in Shanahan now?

"I think first and foremost, he's gifted," Lynch said. "He's incredibly smart. Kyle will tell you, he's not a guy who golfs. Family and football are kind of what he does. That's been that way for a long, long time. So, when he took this job, I believe he was 30 years old, but he was very well seasoned in football, in particular, in that offense. He learned it from his dad. He took it and grew it."

One thing Lynch didn't know about Shanahan heading into this partnership was how the new head coach would be as a leader. It turned out, Shanahan, a head coach who is extremely relatable to his players, excelled at it.

"I think he's tremendous, and I think he's just getting started," Lynch added.

Now, three years after joining the team, Lynch, Shanahan, and their 49ers are in the Super Bowl, and have resurrected a once-great franchise and positioned it for many years of future success.

You can listen to the entire conversation with Lynch below. It begins at about the 4:40 mark.