Fix coverity warning around boost::unordered_map

Refs #10472
Fix coverity warning by refactoring to use common helper function

Refs #10472
Fix bug picked up by coverity.

Refs #10472
Removed unused variable that was detected by coverity.

Refs #10472
Merge pull request #57 from mantidproject/bugfix/10472_coverity_fixes

Looks good to me