SHDP-245 Adding schema generation to avoid NPE when saving objects with null values

- refactoring to avoid deprecation warnings and general polishing

- adding tests for null values and using multiple classes