Tricky parts for a navy demotion might be to call GivePromotionReward afterwards to ensure you get the lower rank's ship again.
That is easy with the player ship, but might get complicated with taking away promotion officers/ships.
At the moment it doesn't do any of that, which means that if you're demoted, you keep what you already had.
Which ALSO means that when you are promoted, you get the rewards a SECOND time.
Not a problem for now because you CAN'T be demoted and promoted again in the current version of the game.
But something to keep in mind for future development...