There's been times I've had a lot of XP & did something stupid & died losing it all - by bottling it up I could've save it before attempting suicidal events
My personal idea is a bit more simplistic...
1. To 'Bottle' your xp you just place a normal glass bottle onto an enchantment table & depending on the amount of Lapis you use determines how much XP is going to be stored in the bottle - as shown on each level.
The enchanted bottle of XP will have a 'glow' effect added to it to show its not a standard 'bottle of XP' & have a Name of 'Bottle of XP [xx]' to show how much is stored in it (where xx] is how many levels it holds)
2. The newly created enchanted 'bottle of XP' is broken just like any other type of Bottle of XP except instead of the normal vanilla low XP levels - it actually give you the number of lvl that were stored based on the Lapis you used
In my attachment it would cost you 1 Lapis to store 8 Levels, 2 Lapis to store 17 Levels & 3 Lapis to store 30 Levels