Refactoring

| Q             | A   |
| ---           | --- |
| Bug fix?      | no  |
| New feature?  | no |
| BC breaks?    | no  |
| Deprecations? | no  |
| Tests pass?   | no |
| Fixed tickets |  |
| License       | MIT |
| Doc PR        | na  |

This PR is trying to factor out the common logic and tidy stuff up.

Note that the last commit is a failed attempt to refactor the enum validator logic, need to do that again.

@danielcsgomes does what I have done to the slugifier make sense to you?