Code cleanup

@lukechurch

This submission does code cleanup for a former submission to wrap some part of the code as functions that can be reused. This submission also makes some other changes.

One test case has been added in:
https://github.com/DynamoDS/Dynamo/pull/1992
This is a pretty bad class name. Whilst you're at it could you send a PR with a refactor to split this into multiple utils classes with their relevant functionality (e.g. RevitElementUtils) grouped together?