[Server] Change tasks to TPL, Change detecting subpurchases and move it to procedure in database