Overstock.com agreed to buy Bed Bath & Beyond's brand and digital assets.