Refactored addSlashIfNeeded as a general purpose apostrophe utility method