refs #NA Move method checkAndWriteIfNeeded to Utils class