Only deposit the amount you can afford to lose. A very old piece of advice but it just boils down to that simple task that you need to follow every time you want to gamble. And stop once you busted that bankroll. Just go back when you have extra funds again. Don't push your luck to the extent that you will borrow money to sustain your gambling activities.
But if that was the advice being followed, you think gambling would be this rampant and people playing almost everyday on the same sites trying to win back what they lost or make some new money? We all talk about bankroll management but rarely it is done by addicted gamblers.
As soon as you start managing your spreadsheets the realization dawns on you about the number of coins you have wasted in gambling which you could have saved and spent somewhere else.
Hence keeping a check on thing is important. Allocate specific amount of money every month to gambling and be strict about it.