Added helper method for serialization in PHP 5.3