protected function persist(ImportMapperInterface $userMapper)
    {
        if (!$userMapper instanceof UserMapperInterface) {
            throw new \Exception('Mapper should be a UserMapper');
        }

        $plainPassword = $userMapper->getPlainPassword();
        $properties    = $userMapper->getProperties();

        $class = $this->getUserClass($properties);

        $results = $class->searchInstances(
            [
                UserRdf::PROPERTY_LOGIN => $properties[UserRdf::PROPERTY_LOGIN]
            ],
            [
                'like' => false,
                'recursive' => true
            ]
        );

        if(count($results) > 0){
            $resource = $this->mergeUserProperties(current($results), $properties);
        } else {
            $resource = $class->createInstanceWithProperties($properties);
        }

        $this->triggerUserUpdated($resource, $properties, $plainPassword);

        return $resource;
    }