Wrote some additional unit tests for the model classes and cleaned up the validation logic for permissions as it was not implemented in the models correctly.