Trying to add support for generic class serialisation