In general, put the code in codeunits instead of on the object on which it operates. This promotes a clean
design and provides the ability to reuse code. It also helps enforce security. For example, typically users do
not have direct access to tables that contain sensitive data, such as the General Ledger Entry table, nor do
they have permission to modify objects. If you put the code that operates on the general ledger in a codeunit,
give the codeunit access to the table, and give the user permission to execute the codeunit, then you will not
compromise the security of the table and the user will be able to access the table