Use querybuilder to prevent concurrency.

Signed-off-by: PedroLourenco <pdrolourenco@gmail.com>
implement wuerybuilder to prevent concurrency