Add Encode and Decode shared methods