I want to delete all the duplicate Bet elements from the MatchOdds nodes except the last one from the following xml sample and than save the file in another destination.
<Sports>
<Sport id="5" name="Tennis">
<Tournament id="3" name="ATP - Basel, Switzerland">
<Match id="8331188" name="Nadal, Rafael v Gasquet, Richard"
startDate="2015-10-31T13:30:00">
<MatchOdds>
<Bet id="20">
<Outcome Special="" name="1" odds="1.35" />
<Outcome Special="" name="2" odds="3.3" />
</Bet>
<Bet id="204">
<Outcome Special="" name="1" odds="1.45" />
<Outcome Special="" name="2" odds="2.85" />
</Bet>
<Bet id="231">
<Outcome Special="" name="1" odds="1.45" />
<Outcome Special="" name="2" odds="2.75" />
</Bet>
<Bet id="206">
<Outcome Special="" name="2 sets" odds="1.55" />
<Outcome Special="" name="3 sets" odds="2.35" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="1.9" />
<Outcome Special="" name="2:1" odds="3.5" />
<Outcome Special="" name="0:2" odds="5.75" />
<Outcome Special="" name="1:2" odds="6.0" />
</Bet>
<Bet id="233">
<Outcome Special="" name="2:0" odds="12312333322" />
<Outcome Special="" name="2:1" odds="123123" />
<Outcome Special="" name="0:2" odds="123123123" />
<Outcome Special="" name="1:2" odds="123123123" />
</Bet>
</MatchOdds>
</Match>
</Tournament>
</Sport>
</Sports>
I want to do it using LINQ - to - XMl(Xdocument class), but I don't know how. Can you please help me with that query? Thanks in advance