Thanks for posting your question in the Microsoft Q&A forum.
For solving this issue, I have two suggestions:
1- You can consider using the Saga pattern and implement it within your system. This involves orchestrating the long-lived process or workflow and managing its state transitions.
2- Alternatively, you can manually implement transactional logic by writing compensating actions for services and operations. If an error occurs at any point in the process, these compensating actions can rollback previous operations to revert the system to its previous state.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful