public function prePersist(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if ($this->checkEntityType($entity)) {
            $password = $entity->getPassword();

            if (!empty($password)) {
                $encodedPassword = $this->encryptPassword($password);
                $entity->setPassword($encodedPassword);
            }
        }
    }