#6257: Refactor SQL code
Merge pull request #6264 from dotCMS/issue-6257-mailing-list

#6257: Refactor SQL code