Ever since Hurricane Maria slammed into Puerto Rico last month, President Trump has been pointing out the commonwealth's "massive debt," as he has put it.

And then on Tuesday on Fox News, he warned Puerto Rico's investors that "you can say goodbye" to the debt issued by the battered U.S. territory.

It wasn't clear exactly what Trump meant by that. But the president's views on Puerto Rico's troubles may have been informed by his own experiences there. Not long ago, he himself ended up on the wrong side of a bet on Puerto Rico's financial health.

Just two years ago, a former Trump International Golf Club in Puerto Rico filed for bankruptcy. The insolvency filing came less than a month after Trump had announced he would run for president, basing his qualifications on his skills as a businessman.

But those skills were sorely tested in Puerto Rico. Here's what happened, starting a decade ago:

Back in 2007, the Trump Organization began a business relationship with the 36-hole, oceanfront club. The owners brought in Trump in hopes of making the four-year-old enterprise thrive, using the New York businessman's brand name and management services.

Once in a Bloomberg interview, Trump's son Eric Trump emphasized that the family had never had ownership stake in the property. "We have zero financial investment in this course," he said. "This is a separate owner. We purely manage the golf course."

It may have sounded good at the time. But at least in retrospect, it seems the Trump family should have seen that the deal was coming with a red warning flag.

Puerto Rico had lost a powerful economic driver the previous year: the so-called Section 936 federal tax write-off for companies with money-earning subsidiaries on the island. The tax shelter had been especially popular with the pharmaceutical industry.

So by the time the club and the Trump Organization were first joining forces, Puerto Rico's unemployment rate was already climbing. It rose from 10.6 percent in March 2008 to an eventual peak of 17 percent in May 2010.

In fact, between 2007 and 2015, the island had just one year of economic growth.

Initially, the Trump-branded club did try to make a splash despite the tough economy. In 2008, it hosted the PGA Puerto Rico Open, and used the tournament to kick-start the condo sales.

"This is clearly going to be a world-class resort," Trump told Florida Golf Magazine at the time. "I never had a project with so much ocean-front."

The magazine quoted Eric Trump as saying, "The PGA tournament served as the ideal platform to debut this one-of-a-kind project to such an important audience."

In fact, it was not all that unusual. The club fit a formula Trump regularly uses: golf plus branding, with high-end residential mixed in. One recent example is the Trump International Golf Club in Dubai — an extravagant 18-hole course and 100 luxury villas.

But compared with Dubai, there was a big difference: the Puerto Rico club was built on a weak financial structure. The privately owned golf course got a government development bank to issue $16.2 million in bonds in 2000. The project took longer and cost more than planned, leading to a $7.5 million bond issue in 2004.

So it really needed to take off in 2008 to live up to all of its financial obligations, but instead, it kept losing money.

From 2008 to 2012, it lost between $5.8 million and $7.2 million annually. In 2012 it had just 63 members, and only four had bought condo units. Mainland players weren't flocking to Coco Beach, and revenues from the Puerto Rico Open were steadily declining.

Throughout those rocky years, the Trump Organization was doing its usual thing: creating six corporate entities to handle the club management and the branding, and naming Ivanka Trump as vice president, as noted in her White House financial disclosure report. The club's 2012 annual report shows it paid Trump 4.5 percent of its gross annual revenues — $609,607 total for the five years from 2008 to 2012. But the report doesn't show what Trump was spending on its operations there.

In 2011, the club's debt got rolled together in a refinancing for $26.4 million. All along, the deal had resembled the U.S. housing crisis — i.e., it had a balloon mortgage, with small, interest-only payments for the first several years.

The re-fi didn't help. In 2012, the club defaulted, and for the next three years, its debt payments were made by Puerto Rico's Tourism Development Fund, which was guaranteeing the bonds.

In 2015, the Trump partnership ended. The club reverted to its original name — the Coco Beach Golf and Country Club — and filed for bankruptcy. It claimed $9.2 million in assets and $78.1 million in liabilities: $32.6 million in bonds and $45.5 million to other creditors. The Tourism Development Fund sought to recover $32.1 million in principal and interest on the bonds.

Much further down the list, Trump International Golf Club at Coco Beach claimed $690,339 in unpaid management fees.

Copyright 2017 NPR. To see more, visit http://www.npr.org/.