Try to do it through a server side query. Essentially the same as the
first approach but asynchronus.