public function checkRateLimit()
    {
        $rateLimit = $this->getRateLimit();
        if ($rateLimit !== null) {
            list($maxRequests, $timeWindow) = $rateLimit;
            $visits = $this->getVisitsCountFromCurrentIP($timeWindow);
            if ($visits >= $maxRequests) {
                throw new UserMessageException(t('You reached the API rate limit (%1$s requests every %2$s seconds)', $maxRequests, $timeWindow));
            }
            $this->app->make(IPControlLog::class)->addVisit('api');
        }
    }