BlackBerry sells itself for $4.7 billion