public function addEvents(AbstractData $data, $passwordField = 'password', $saltField = 'salt')
    {

        $that = $this;
        $saltGenFunction = function(Entity $entity) use ($saltField, $that) {
            $salt = $that->getSalt(40);
            $entity->set($saltField, $salt);
            return true;
        };

        $data->getEvents()->push('before', 'create', $saltGenFunction);

        $pwHashFunction = $this->getPWHashFunction($data, $passwordField, $saltField);

        $data->getEvents()->push('before', 'create', $pwHashFunction);
        $data->getEvents()->push('before', 'update', $pwHashFunction);

    }