Refactored an extension method ToByteString in ByteArrayExtensions class.