BlackBerry Agrees to Sell Legacy Patents