Generic bean serialization