Refactored saving article categories function