Clean up the Dispose Method
Clean up the Dispose Method

This commit fixes a race condition in Dispose where we could be in the middle
of inserting an object while the Dispose executes

shana/Akavache,bbqchickenrobot/Akavache,jcomtois/Akavache,ghuntley/AkavacheSandpit,Loke155/Akavache,martijn00/Akavache,mms-/Akavache,MathieuDSTP/MyAkavache,gimsum/Akavache,PureWeen/Akavache,akavache/Akavache,christer155/Akavache,shiftkey/Akavache,MarcMagnin/Akavache,kmjonmastro/Akavache,shana/Akavache