Serialization refactoring Part1

Signed-off-by: MHesham <mhesham.fcis@gmail.com>