Move generic (de)serialization code into (Des/S)erializers namespace

Change-Id: I54d03df869ca5774a879f6daa9d5c814ad8cabf7