refactored the saveOrUpdate code and moved it into a Utility class that gets injected.