Separate deserializer into generic class