// GET api/tutorialstage/uniqueKey@@stage
        public async Task<Result> Get(string id)
        {
            string[] parts = id.Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
            string playerKey = parts[0];            
            int stage = Int32.Parse(parts[1]);

            try
            {
                GamePlayerStorageInformation storageInfo = new GamePlayerStorageInformation(playerKey);
                GamePlayer player = await ConfigurableDataProvider.Instance
                    .Get<GamePlayer, GamePlayerCacheable, GamePlayerTableStorage>(storageInfo);

                if (player == null)
                {
                    return new Result { ErrorCode = ErrorCode.ERROR_RETRIEVING_ACCOUNT };
                }

                GamePlayerLogic.Instance.SetTutorialStage(player, stage);

                if (player.StateChanged)
                {
                    player.StateChanged = false;
                    await ConfigurableDataProvider.Instance
                        .Save<GamePlayer, GamePlayerCacheable, GamePlayerTableStorage>(player, storageInfo);
                }

                return new Result { ErrorCode = ErrorCode.ERROR_OK, Item = null };
            }
            catch (Exception ex)
            {
                return new Result { ErrorCode = ErrorCode.ERROR_RETRIEVING_ACCOUNT, Item = ex.Message };
            }
        }
        // GET api/finishwork/5
        public async Task<Result> Get(string id)
        {
            try
            {
                GamePlayerStorageInformation storageInfo = new GamePlayerStorageInformation(id);
                GamePlayer player = await ConfigurableDataProvider.Instance
                    .Get<GamePlayer, GamePlayerCacheable, GamePlayerTableStorage>(storageInfo);

                if (player == null)
                {
                    return new Result { ErrorCode = ErrorCode.ERROR_RETRIEVING_ACCOUNT };
                }

                DateTime[] now = new DateTime[1];  
                now[0] = DateTime.UtcNow;
                List<WorkInProgress> items = GamePlayerLogic.Instance.FinishWork(player, now[0]);

                if (player.StateChanged)
                {
                    player.StateChanged = false;
                    await ConfigurableDataProvider.Instance
                        .Save<GamePlayer, GamePlayerCacheable, GamePlayerTableStorage>(player, storageInfo);
                }

                return new Result { ErrorCode = ErrorCode.ERROR_OK, Item = now };
            }
            catch (Exception ex)
            {
                return new Result { ErrorCode = ErrorCode.ERROR_RETRIEVING_ACCOUNT, Item = ex.Message };
            }
        }
        public void Initialize()
        {
            storageInfo = new GamePlayerStorageInformation("KEVIN");

            player = new GamePlayer
            {
                Coins = 99,
                Coupons = 66,
                Experience = 1000,
                Level = 4,
                StateChanged = false,
                WorkInProgress = new List<WorkInProgress>
                {
                    new WorkInProgress 
                    {
                        Quantity = new ItemQuantity                        
                        {
                            ItemCode = BuildableItemEnum.Dough_Mixer,
                            Level = 1,
                            UnStoredQuantity = 2
                        },
                        Location = 0,                       
                        FinishTime = DateTime.UtcNow
                    }
                },        
                Locations = new List<BusinessLocation>
                {
                    new BusinessLocation
                    {
                        Storage = new LocationStorage
                        { 
                            Items = new Dictionary<BuildableItemEnum,ItemQuantity>
                            {
                                { 
                                    BuildableItemEnum.White_Flour, new ItemQuantity
                                    {
                                        ItemCode = BuildableItemEnum.White_Flour,
                                        Level = 0,
                                        UnStoredQuantity = 1,
                                        StoredQuantity = 2
                                    }
                                },
                                {
                                    BuildableItemEnum.Dirty_Dishes, new ItemQuantity
                                    {
                                        ItemCode = BuildableItemEnum.Dirty_Dishes,
                                        Level = 0,
                                        UnStoredQuantity = 2,
                                        StoredQuantity = 0
                                    }
                                }
                            }
                        }
                    }
                },
                TutorialStage = 10
            };
        }
        // GET api/gameplayer/5
        public async Task<Result> Get(string id)
        {
            try
            {
                GamePlayerStorageInformation storageInfo = new GamePlayerStorageInformation(id.ToString());
                GamePlayer player = await ConfigurableDataProvider.Instance
                    .Get<GamePlayer, GamePlayerCacheable, GamePlayerTableStorage>(storageInfo);

                if (player == null)
                {
                    return new Result { ErrorCode = ErrorCode.ERROR_RETRIEVING_ACCOUNT };
                }

                GamePlayerAPIMorph morph = new GamePlayerAPIMorph();
                return new Result { ErrorCode = ErrorCode.ERROR_OK, Item = morph.ToAPIFormat(player) };
            }
            catch (Exception)
            {
                return new Result { ErrorCode = ErrorCode.ERROR_RETRIEVING_ACCOUNT };
            }
        }