Implemented encode and decode functions in synchronize.go