Add serialization

Add serialization for BinaryTreeImpl. Tests to be written.