protected function getUsers(array $data, string $domain): array
    {
        /**
         * @var \CakeDC\Users\Model\Table\UsersTable $table
         */
        $table = $this->getUsersTable();

        $result = [];
        for ($i = 0; $i < $data['count']; $i++) {
            $username = $data[$i]['userprincipalname'][0];
            $username = str_replace('@' . $domain, '', $username);

            $query = $table->find()->where(['username' => $username]);
            if ($query->isEmpty()) {
                continue;
            }

            $result[] = $query->first();
        }

        return $result;
    }