How to place modal and spinner on screen until database save operation completes

I had some similar questions/insights here: Loading animations / progress bars

Generally, I’ve found it difficult to find resources on getting spinners to work properly under various scenarios.