fix(metadata): make metadata nullable

so that we can revert to previous version when it was not set
fix(rule_set): validate on delete if rule_set is in use

and prevent delete if it is

SD-1243
Merge pull request #433 from petrjasek/master

fix(metadata): make metadata nullable