Reference taken from : https://github.com/agilecrm/php-api