ST. LOUIS (AP) — When the congregation moved out of a century-old Methodist church in St. Louis, the building could have turned into a vacant eyesore. Instead, Lisa and Dan Macheca bought it and turned it into a bed and breakfast.

St. Louis Public Radio reports that former religious buildings are finding new life as inns and coffee shops, among other things. The process known as adaptive reuse is becoming increasingly common as religious preferences shift.

Commercial real estate database CoStar says more than 6,800 religious buildings have been sold in the past five years and more than 1,400 are for sale.

In Columbia, Illinois, near St. Louis, Cafe on the Abbey opened last year inside a former convent. Patrons can sip coffee beneath a life-size painting of nuns enjoying a meal together.

The percentage of Americans who belong to a church, mosque or synagogue has declined in the past two decades, forcing some religious leaders to sell the houses of worship and merge with other congregations.

Many religious buildings were built during periods of religious growth, said Cleveland State University professor of urban planning Robert Simons.

"The buildings we have that were built in the '40s, '50s and '60s are not really functional for today's perspective," said Simons, author of the book "Retired, Rehabbed, Reborn: The Adaptive Reuse of America's Derelict Religious Buildings and Schools." ''Too many classrooms, a little bit too big."

When the buildings fall into disrepair, the financial burden can be devastating for a shrinking congregation.

Today, many of the buildings are being reborn.

Cafe on the Abbey co-owners Danny Ball and Marcia Johns-Brooks are leaning into the history of the building. Even the logo, a nun drinking coffee, pays homage to the building's previous life.

"We've been very playful with that," said Ball, who also serves as head chef. "Playful and respectful."

The coffee shop is part of an $8 million development, which includes a hair salon, event space and loft apartments.

Ball is thankful the buildings found a new life after the Catholic congregation moved to a new site across town in 2013.

Not that it's always easy. The Machecas didn't take into consideration the cost of heating the former church when they bought it back in 2004. The first heating bill was $5,000 for a single month.

"I felt like crying," Lisa Macheca said. "Like, 'Oh my gosh, what have I gotten myself into?'"

Simons said a new construction project might have fewer surprises, but old houses of worship often have unique features that customers find desirable.

"The exterior of the building, the belovedness it has among the community, that's all a positive," he said. "What you really want is the stained glass and the beautiful interior finish."

Running the bed and breakfast brings meaningful encounters for the Machecas. Many of the guests once worshipped at the church and return to use it for weddings, anniversaries and other events. It recently hosted a wedding for a woman whose grandparents wed in the church 80 years earlier.

"It's amazing the connections I've made with people," Lisa Macheca said. "I just love hearing their stories."