Staples (NASDAQ:SPLS), the leading office supply retailer in the United States, has been in my portfolio since the middle of 2012. I originally bought the stock not only because it appeared undervalued to me, but because the company had an important competitive advantage that most retailers lack. Staples is not just a retailer. Tthe commercial business, where Staples sells directly to large organizations, provided the company with a strong foundation that was unlikely to be easily disrupted by online competition from the likes of Amazon. In my view, along with the low price that I originally paid for the stock, the commercial business provided an ample margin of safety that would protect me from unforeseen events.

After I first invested in Staples, the stock rose significantly, allowing me to trim my position for a solid gain. The retail business then began to deteriorate, with not only sales but also operating margins declining precipitously, and the stock was sent back to the same levels at which I first invested. I used this opportunity to buy more Staples, at the lowest price yet.

Why am I digging in?
With all the trouble that Staples is having with its retail business, closing hundreds of stores and struggling to maintain profitability, why am I sticking with the stock? It all goes back to the commercial business, which has proven to be resilient, even growing as retail sales are shrinking. Staples is going to change over the next few years, closing many stores and remodeling others, and the commercial business will become a larger part of the company's business. This shouldn't be viewed as a failure by investors; the world is changing, and Staples needs to change with it. Instead, it should be viewed as an opportunity to buy a stock with a high level of uncertainty but, at least in my view, a far lower level of risk.

Staples has managed to continue growing the commercial business despite retail weakness for a few reasons. First, the company offers free delivery to all of its commercial customers, often on the next business day. It can do this because Staples operates its own fleet of trucks, and there's simply no way that a competitor relying on UPS or FedEx for deliveries can match this level of service.

Second, Staples has greatly expanded the types of products that its sells. The company is no longer simply an office supply vendor, selling just ink and paper products, but instead has expanded into complementary categories. From facilities and breakroom supplies to specialized categories like restaurant supplies, Staples is aiming to offer businesses everything they need.

The commercial business recorded an operating income of $604 million in fiscal 2013, and with the current market capitalization at about $8 billion, the stock trades at about 13 times this number, entirely ignoring the contribution from the retail segment. While the retail stores have become far less profitable over the past year, they're still making money, and it won't take much of an improvement to make the current stock price look like a bargain.

In fiscal 2013, the North American Retail and Online segment recorded $733 million in operating income. This number is on pace to be far lower this year, as margins in the segment have taken a dive, and the high-single digit operating margins of the past may never return.

Part of the problem is that Staples is aggressively growing its presence online, and investments in e-commerce, along with lower margins online in general, are dragging down profitability. There are also far too many stores across the office supply industry, and both Staples and rival Office Depot are closing hundreds of stores over the next few years. This consolidation of sales should help the profitability of the retail segment once the dust settles.

The NA Retail and Online segment was an $11 billion business in 2013, and while it will be smaller this year with sales declines and store closings, even a low single-digit operating margin would add considerably to the company's bottom line. I see no good reason why Staples can't achieve this.

Foolish thoughts
The story at Staples has two parts. First, there's the commercial business, which has proven to be resilient, growing while both demand for core office supplies and Staples' retail sales have been shrinking. This is the main reason why I own Staples stock, and I believe that the company has a meaningful competitive advantage in this area. Second, there's the retail business, which has been struggling lately, but with store closings and cost cuts, should be able to generate consistent profits, albeit at lower margins than in the past.

In the long run, mid-single digit operating margins companywide should be sustainable, and that would lead to an operating profit in excess of $1 billion. With the stock price at just eight times this number, I believe that Staples is ultimately worth quite a bit more than it trades for today.