Creating and registering custom validation class