Business Logic Problem

Hi everyone!
I have a business logic problem, I'm developing a financial management application, but whenever I make accounts releases creating a register, for example an outcome of 50 dollars, I have to create a release register in my registers collection (I'm using MongoDB) and update the account balance which is in another collection. My question is how can I separate the registers logic from the account logic? I want to make some kind of observer and whenever the register is created or modified I want the account to be notified and changed too. Here is how my entities look like and my services are looking good except from the register service which is a mess because I'm also changing the accounts there.
image.png
image.png
Was this page helpful?