public void Modify(double newPrice)
        {
            Debug.Assert(newPrice > 0);

            Log.WriteLog("Trying to confirm order " + this.ID.ToString() + ": \"" + this.Type.ToString() + "\" before modifying.");

            List<MyOrder> retrivedOrders = null;
            Me me;
            bool success;
            using (new FrameLock(true))
            {
                EVE.ISXEVE.EVE eve = new EVE.ISXEVE.EVE();

                // me is not persistent, we can't just keep a static reference somewhere, have to renew every frame;
                me = new Me();
                success = me.UpdateMyOrders();
            }

            if (success)
            {
                Log.WriteLog("Fired update order request, wait to get result.");

                int counter = 0;

                while (retrivedOrders == null && counter < 100)
                {
                    Frame.Wait(false);
                    using (new FrameLock(true))
                    {
                        counter++;
                        // me is not persistent, we can't just keep a static reference somewhere,have to renew every frame;
                        me = new Me();

                        EVE.ISXEVE.Character.OrderType orderType = this.OrderType == OrderType.Buy ? EVE.ISXEVE.Character.OrderType.Buy : EVE.ISXEVE.Character.OrderType.Sell;

                        // IMPORTANT: This is shallow copy, we need to finish all DEEP copy value operations while locked, otherwise the memory will be flushed;
                        retrivedOrders = me.GetMyOrders(orderType, this.TypeID);

                        if (retrivedOrders != null)
                        {
                            if (MarketOrderSet.ValidateOrderData(retrivedOrders))
                            {
                                MyOrder orderToModify = null;

                                foreach (MyOrder o in retrivedOrders)
                                {
                                    if (o.ID == ID)
                                    {
                                        orderToModify = o;
                                        break;
                                    }
                                }

                                if (orderToModify != null)
                                {
                                    Log.WriteLog("Confirmed order with (" + counter.ToString() + ") attempts.");

                                    DateTime lastModifiedTime = new System.DateTime(1601, 1, 1).AddSeconds(orderToModify.TimeStampWhenIssued / 10000000);

                                    //real cool down takes 5 minutes
                                    if (lastModifiedTime.AddMilliseconds(301000) < System.DateTime.UtcNow)
                                    {
                                        orderToModify.Modify(newPrice);

                                        Price = newPrice;
                                        ModifyCoolDownEndTime = System.DateTime.UtcNow.AddMilliseconds(_config.RandomizedOrderModifyIntervalInMilliSec);
                                        //I think the date, time and timestamp dont need updating.

                                        Log.WriteLog("Order " + this.ID.ToString() + ": \"" + this.Type.ToString() + "\" modified");
                                    }
                                    else
                                    {
                                        ModifyCoolDownEndTime = lastModifiedTime.AddMilliseconds(_config.RandomizedOrderModifyIntervalInMilliSec);
                                        Log.WriteLog("Order cooldown not finished yet. Job \"Modify\" cancelled.");
                                    }
                                }
                                else
                                {
                                    Log.WriteLog("Failed to find order to modify with (" + counter.ToString() + ") attempts. Job \"Modify\" cancelled.");
                                }
                            }
                            else
                            {
                                Log.WriteLog("Found invalid data in retrived order, retrying.");
                                // Enter next loop;
                                retrivedOrders = null;
                            }
                        }
                    }
                }
            }
            else
            {
                Log.WriteLog("Failed to send update order request. Job \"Modify\" cancelled.");
            }
        }
        public void LoadMarketOrderInfo()
        {
            Log.WriteLog("Trying to load market orders.");

            List<MyOrder> retrivedOrders = null;
            Me me;
            bool success;
            using (new FrameLock(true))
            {
                EVE.ISXEVE.EVE eve = new EVE.ISXEVE.EVE();

                // me is not persistent, we can't just keep a static reference somewhere, have to renew every frame;
                me = new Me();

                success = me.UpdateMyOrders();
            }

            if (success)
            {
                Log.WriteLog("Fired update order request, wait to get result.");

                int counter = 0;

                while (retrivedOrders == null && counter < 100)
                {
                    Frame.Wait(false);
                    using (new FrameLock(true))
                    {
                        counter++;
                        // me is not persistent, we can't just keep a static reference somewhere,have to renew every frame;
                        me = new Me();

                        // IMPORTANT: This is shallow copy, we need to finish all DEEP copy value operations while locked, otherwise the memory will be flushed;
                        retrivedOrders = me.GetMyOrders();

                        if (retrivedOrders != null)
                        {
                            if (ValidateOrderData(retrivedOrders))
                            {
                                _combineNewOrder(retrivedOrders);
                            }
                            else
                            {
                                Log.WriteLog("Found invalid data in retrived order, retrying.");
                                // Enter next loop;
                                retrivedOrders = null;
                            }
                        }
                    }
                }

                if (retrivedOrders != null)
                {
                    Log.WriteLog("Got " + retrivedOrders.Count.ToString() + " orders with (" + counter.ToString() + ") attempts.");
                }
                else
                {
                    Log.WriteLog("Failed to load orders with (" + counter.ToString() + ") attempts.");
                }
            }
            else
            {
                Log.WriteLog("Failed to send update order request.");
            }

            Log.WriteLog("Done loading market orders.");
        }