Beginning of getOrders from database