```\nif (from.status == IStructs.StakeStatus.DELEGATED) {\n    \_undelegateStake(\n        from.poolId,\n        staker,\n        amount\n    );\n}\n  \nif (to.status == IStructs.StakeStatus.DELEGATED) {\n    \_delegateStake(\n        to.poolId,\n        staker,\n        amount\n    );\n}\n```\n