Added singletone class pattern for apex.