Tip when code should be stored at the data class level and when at the representation level
When using classes and representations to perform CRUD functions, it is important to place the code at the right level.
In summary, all the code that properly makes your entity work and handles the errors in service mode must be there.
The principles are: do not trust the client layer and do not expect that a forbidden operation cannot be called even if it has been disabled in the representation. It might be called in service mode, so you have to assume the control and to reject any operation if it is forbidden.