Added basic WriteObject method with a simple test