replace dots in keyname with tildes

mongo 2.6+ doesnt support keynames containing dots.
Try to use tilde version of url if dot version fails

mongo 2.6+ doesnt support dots in key names so when saving
they are now saved with tilde's.  however, some older installs
still have the dots so I try to manipulate the dot version first
and if that fails then I try the tilde version.  If that fails
I leave how the system already handled that scenario.
use permalink instead of locallink

permalink is guaranteed to be accuraet whereas locallink might include
tildes in mongo 2.6+.  We store permalink as a field so might as well
use it as the authoratative value.
move tilde deletion logic up one level

the permissions work on the permalink but not the mangled (tilde)
so move the delete into the correct permissions block and only
do it if the non-tilde fails.

exit as normal if both fail
trying to respect indentation rules
remove extraneous newline at end of file
trying to respect indentation rules

also removed extraneous newline at end of file
Merge pull request #466 from finalcut/fix_annotations_in_mongo26plus

Closes 447 : Fix annotations in mongo26plus. Thank you @finalcut!