created utility methods for encoding/decoding complex data type