//TODO:
        public AddFavoriteResponse AddUserFavourite(AddFavoriteRequest addFavoriteRequest)
        {
            AddFavoriteResponse resp = new AddFavoriteResponse();
            resp.Message = null;
            resp.Result = false;
            List<SqlParameter> sqlParam = new List<SqlParameter>();
            string sqlStr = null;
            //Check UserId, PageNumber and ChapterNumber valid
            if (addFavoriteRequest.UserId > 0 && addFavoriteRequest.PageNumber > 0 && addFavoriteRequest.ChapterNumber > 0)
            {
                //Check Favorite record exist in UserFavorite table or not
                DBUtility.AddSqlParam(sqlParam, "@UserId", SqlDbType.BigInt, addFavoriteRequest.UserId);
                DBUtility.AddSqlParam(sqlParam, "@PageNumber", SqlDbType.BigInt, addFavoriteRequest.PageNumber);
                DBUtility.AddSqlParam(sqlParam, "@ChapterNumber", SqlDbType.BigInt, addFavoriteRequest.ChapterNumber);
                sqlStr = @"select uf.Id
                                from UserFavorites uf
                                join PageInfo pi on pi.Id = uf.PageInfo
                                join Chapter c on c.Id = pi.Chapter
                                where uf.UserId = @UserId and uf.PageNumber = @PageNumber and c.Number = @ChapterNumber";
                DataSet favoriteSet = DBUtility.ExecuteDataset(sqlStr, sqlParam);
                if (DBUtility.hasResult(favoriteSet))
                {
                    resp.Message = "User Favorite exist. UserID " + addFavoriteRequest.UserId +
                                        " Chapter# " + addFavoriteRequest.ChapterNumber +
                                        " Page# " + addFavoriteRequest.PageNumber;
                    resp.Result = true;
                }
                else
                {//add Favorite into UserFavorites table
                    sqlStr = @"select pi.Id as PageInfo
                                from PageInfo pi
                                join Chapter c on c.Id = pi.Chapter
                                where c.Number = @ChapterNumber and pi.Number = @PageNumber";
                    int pageInfo = 0;
                    DataSet pageInfoSet = DBUtility.ExecuteDataset(sqlStr, sqlParam);
                    if (DBUtility.hasResult(pageInfoSet))
                    {
                        pageInfo = Convert.ToInt32(pageInfoSet.Tables[0].Rows[0]["PageInfo"]);

                        sqlParam.Clear();
                        DBUtility.AddSqlParam(sqlParam, "@UserId", SqlDbType.BigInt, addFavoriteRequest.UserId);
                        DBUtility.AddSqlParam(sqlParam, "@PageInfo", SqlDbType.BigInt, pageInfo);
                        DBUtility.AddSqlParam(sqlParam, "@PageNumber", SqlDbType.BigInt, addFavoriteRequest.PageNumber);
                        DBUtility.AddSqlParam(sqlParam, "@FavoriteName", SqlDbType.NVarChar, addFavoriteRequest.FavoriteName);
                        DBUtility.AddSqlParam(sqlParam, "@CreatedOn", SqlDbType.DateTime, DateTime.Now);
                        DBUtility.AddSqlParam(sqlParam, "@LastModifiedDate", SqlDbType.DateTime, DateTime.Now);
                        DBUtility.AddSqlParam(sqlParam, "@LastModifiedBy", SqlDbType.NVarChar, "System");
                        sqlStr = @"insert into UserFavorites(UserId, PageInfo, PageNumber, FavoriteName, CreatedOn, LastModifiedDate, LastModifiedBy)
                                        values (@UserId, @PageInfo, @PageNumber, @FavoriteName, @CreatedOn, @LastModifiedDate, @LastModifiedBy);";
                        if (DBUtility.ExecuteNonQuery(sqlStr, sqlParam) != 1)
                        {
                            throw new ServiceException("Insert UserFavorites failed. UserID: " + addFavoriteRequest.UserId);
                        }
                        resp.Message = "UserFavorite inserted. UserID: " + addFavoriteRequest.UserId +
                                                "; Chapter#: " + addFavoriteRequest.ChapterNumber +
                                                "; Page#: " + addFavoriteRequest.PageNumber; ;
                        resp.Result = true;
                    }
                    else
                    {
                        resp.Message = "No Page exist";
                        resp.Result = false;
                    }
                }
            }
            return resp;
        }
        public Response PostRequest(Stream input)
        {
            String postedValue = retrievePostValue(input);
            Request request = new JavaScriptSerializer().Deserialize<Request>(postedValue);
            Response response = new Response();

            String serializedRequestData = new JavaScriptSerializer().Serialize(request.RequestData);
            log.Debug("EnglishRemix2: PostRequest, MethodName:" + request.MethodName + ", TimeStamp:" + request.PostTime + ", RequestData: " + serializedRequestData);

            try
            {
                if (request.MethodName.ToLower().Equals("activation"))
                {
                    DeviceActivationRequest deviceActivationRequest = new JavaScriptSerializer().Deserialize<DeviceActivationRequest>(serializedRequestData);
                    DeviceActivationResponse deviceActivationResponse = new DeviceActivationResponse();
                    deviceActivationResponse = deviceFacade.ActivateDevice(deviceActivationRequest);
                    response.ResponseData = new JavaScriptSerializer().Serialize(deviceActivationResponse);
                    response.HasError = false;
                    systemFacade.Log("0", "1", "1", "activation", 1);
                    return response;
                }

                //use DUID and UID to do the request authantication here
                if (!DeviceValidator.Instance.isValid(request.UserId, request.Udid))
                {
                    response.HasError = true;
                    response.ErrorMsg = ResponseMessages.DEVICE_VALIDATION_FAILED_MESSAGE;
                    response.ResponseData = new JavaScriptSerializer().Serialize(new DeviceValidationResponse());
                    systemFacade.Log("0", "1", "1", "Request authentication failed.", 1);
                    return response;
                }

                // Request Device is activated. Request is authenticated.
                switch (request.MethodName.ToLower())
                {
                    case "register":
                        log.Debug("EnglishRemix2, Action: Register");
                        RegistrationRequest registrationRequest = new JavaScriptSerializer().Deserialize<RegistrationRequest>(serializedRequestData);
                        RegistrationResponse resgitrationResponse = new RegistrationResponse();
                        resgitrationResponse = userFacade.RegisterUser(registrationRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(resgitrationResponse);
                        systemFacade.AddUserAction("0", request.MethodName.ToLower(), registrationRequest.UserName, registrationRequest.password, "0");
                        systemFacade.Log("0", "1", "1", resgitrationResponse.Message, 1);
                        break;
                    case "login":
                        log.Debug("EnglishRemix2, Action: Login");
                        LoginRequest loginRequest = new JavaScriptSerializer().Deserialize<LoginRequest>(serializedRequestData);
                        LoginResponse loginResponse = new LoginResponse();
                        loginResponse = userFacade.LoginUser(loginRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(loginResponse);
                        systemFacade.AddUserAction("0", request.MethodName.ToLower(), loginRequest.UserName, loginRequest.Password, "0");
                        systemFacade.Log("0", "1", "1", "", 1);
                        break;
                    case "getuserachievement":
                        log.Debug("EnglishRemix2, Action: getuserachievement");
                        AchievementRequest achievementRequest = new JavaScriptSerializer().Deserialize<AchievementRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), "0", "0", "0");
                        AchievementResponse achievementResp = userFacade.GetUserAchievement(achievementRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(achievementResp);
                        systemFacade.Log("0", "1", "1", "userachievements", 1);
                        break;
                    case "getallachievements":
                        log.Debug("EnglishRemix2, Action: getallachievement");
                        AchievementResponse achievementResps = userFacade.GetAllAchievements();
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), "0", "0", "0");
                        response.ResponseData = new JavaScriptSerializer().Serialize(achievementResps);
                        systemFacade.Log("0", "1", "1", "allachievements", 1);
                        break;
                    case "getchapter":
                        log.Debug("EnglishRemix2, Action: getChapter, serializedRequestData:" + serializedRequestData);
                        ChapterRequest chapterRequest = new JavaScriptSerializer().Deserialize<ChapterRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), chapterRequest.ChapterNumber.ToString(), "0", "0");
                        ChapterResponse chapterResp = contentFacade.GetChapterByNumber(chapterRequest.ChapterNumber);
                        response.ResponseData = new JavaScriptSerializer().Serialize(chapterResp);
                        systemFacade.Log("0", "1", "1", "getchapter", 1);
                        break;
                    case "getchapterlist":
                        log.Debug("EnglishRemix2, Action: getChapter, serializedRequestData:" + serializedRequestData);
                        ChapterListRequest chapterListRequest = new JavaScriptSerializer().Deserialize<ChapterListRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), "0", "0", "0");
                        ChapterListResponse chapterListResponse = contentFacade.GetChapterList();
                        response.ResponseData = new JavaScriptSerializer().Serialize(chapterListResponse);
                        systemFacade.Log("0", "1", "1", "getchapterlist", 1);
                        break;
                    case "updateactivitystatusbyuser":
                        log.Debug("EnglishRemix2, Action:updateactivitystatusbyuser");
                        UpdateActivityStatusRequest updateActivityStatusRequest = new JavaScriptSerializer().Deserialize<UpdateActivityStatusRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), updateActivityStatusRequest.ActivityId.ToString(), updateActivityStatusRequest.ActivityStatusName, "0");
                        UpdateActivityStatusResponse updateActivityStatusResponse = userFacade.UpdateActivityStatusByUser(updateActivityStatusRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(updateActivityStatusResponse);
                        systemFacade.Log("0", "1", "1", updateActivityStatusResponse.Message, 1);
                        break;
                    case "getuseractivitystatsus":
                        log.Debug("EnglishRemix2, Action: getuseractivitystatus");
                        UserActivityStatusRequest userActivityStatusRequest = new JavaScriptSerializer().Deserialize<UserActivityStatusRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), userActivityStatusRequest.ChapterNumber.ToString(), "0", "0");
                        UserActivityStatusResponse userActivityStatusResp = new UserActivityStatusResponse();
                        userActivityStatusResp = userFacade.GetUserActivityStatus(userActivityStatusRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(userActivityStatusResp);
                        systemFacade.Log("0", "1", "1", "getuseractivitystatus", 1);
                        break;
                    case "allusers":
                        log.Debug("EnglishRemix2, Action: allusers");
                        response.ResponseData = new JavaScriptSerializer().Serialize(userFacade.GetAllUserInfo());
                        systemFacade.Log("0", "1", "1", "allusers", 1);
                        break;
                    case "getuser":
                        log.Debug("EnglishRemix2, Action: getuser");
                        UserRequest userRequest = new JavaScriptSerializer().Deserialize<UserRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), "0", "0", "0");
                        UserResponse userResp = new UserResponse();
                        userResp = userFacade.GetUserInfo(userRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(userResp);
                        systemFacade.Log("0", "1", "1", "getuser", 1);
                        break;
                    case "updateuser":
                        log.Debug("EnglishRemix2, Action: updateUser");
                        UpdateUserRequest updateUserRequest = new JavaScriptSerializer().Deserialize<UpdateUserRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), updateUserRequest.Coin.ToString(), updateUserRequest.Level.ToString(), updateUserRequest.ActivationStatus.ToString());
                        UpdateUserResponse updatedUserResp = new UpdateUserResponse();
                        updatedUserResp = userFacade.UpdateUser(updateUserRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(updatedUserResp);
                        systemFacade.Log("0", "1", "1", updatedUserResp.Message, 1);
                        break;
                    case "updatepassword":
                        log.Debug("EnglishRemix2, Action: updatePassword");
                        UpdatePasswordRequest changePwdRequest = new JavaScriptSerializer().Deserialize<UpdatePasswordRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), "0", "0", "0");
                        UpdatePasswordResponse changePwdResp = new UpdatePasswordResponse();
                        changePwdResp = userFacade.UpdatePassword(changePwdRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(changePwdResp);
                        systemFacade.Log("0", "1", "1", changePwdResp.Message, 1);
                        break;
                    case "purchaseactivity":
                        log.Debug("EnglishRemix2, Action: purchaseactivity");
                        UserActivityRequest purchaseActivityRequest = new JavaScriptSerializer().Deserialize<UserActivityRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), purchaseActivityRequest.ActivityId.ToString(), "0", "0");
                        UserActivityResponse purchaseActivityResp = new UserActivityResponse();
                        purchaseActivityResp = userFacade.PurchaseActivity(purchaseActivityRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(purchaseActivityResp);
                        systemFacade.Log("0", "1", "1", purchaseActivityResp.Message, 1);
                        break;
                    case "adduserfavorite":
                        log.Debug("EnglishRemix2, Action: adduserFavorite");
                        AddFavoriteRequest addFavoriteRequest = new JavaScriptSerializer().Deserialize<AddFavoriteRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), addFavoriteRequest.ChapterNumber.ToString(), addFavoriteRequest.PageNumber.ToString(), "0");
                        AddFavoriteResponse addFavoriteResp = new AddFavoriteResponse();
                        addFavoriteResp = userFacade.AddUserFavourite(addFavoriteRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(addFavoriteResp);
                        systemFacade.Log("0", "1", "1", addFavoriteResp.Message, 1);
                        break;
                    case "getuserfavorite":
                        log.Debug("EnglishRemix2, Action: getuserFavorite");
                        GetFavoriteRequest getUserFavoriteRequest = new JavaScriptSerializer().Deserialize<GetFavoriteRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), "0", "0", "0");
                        GetFavoriteResponse getUserFavoriteResp = new GetFavoriteResponse();
                        getUserFavoriteResp = userFacade.GetUserFavorite(getUserFavoriteRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(getUserFavoriteResp);
                        systemFacade.Log("0", "1", "1", "getuserfavourite", 1);
                        break;
                    case "deleteuserfavorite":
                        log.Debug("EnglishRemix2, Action: deleteUserFavorite, serializeRequesetData: " + serializedRequestData);
                        DeleteFavoriteRequest deleteUserFavoriteRequest = new JavaScriptSerializer().Deserialize<DeleteFavoriteRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), deleteUserFavoriteRequest.ChapterNumber.ToString(), deleteUserFavoriteRequest.PageNumber.ToString(), "0");
                        DeleteFavoriteResponse deleteUserFavoriteResponse = new DeleteFavoriteResponse();
                        deleteUserFavoriteResponse = userFacade.DeleteUserFavorite(deleteUserFavoriteRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(deleteUserFavoriteResponse);
                        systemFacade.Log("0", "1", "1", deleteUserFavoriteResponse.Message, 1);
                        break;
                    case "uploadvideo":
                        log.Debug("EnglishRemix2, Action: uploadvideo");
                        UploadVideoRequest uploadVideoRequest = new JavaScriptSerializer().Deserialize<UploadVideoRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), uploadVideoRequest.ActivityId.ToString(), uploadVideoRequest.ChapterNumber.ToString(), uploadVideoRequest.SelfScore.ToString());
                        UploadVideoResponse uploadVideoResp = new UploadVideoResponse();
                        uploadVideoResp = videoFacade.UploadVideo(uploadVideoRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(uploadVideoResp);
                        systemFacade.Log("0", "1", "1", "uploadvideo", 1);
                        break;
                    case "getuploadedvideolist":
                        log.Debug("EnglishRemix2, Action: getUploadedVideo, serializedRequestData:" + serializedRequestData);
                        VideoListRequest videoListRequest = new JavaScriptSerializer().Deserialize<VideoListRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), videoListRequest.ActivityId.ToString(), videoListRequest.SentenceNumber.ToString(), "0");
                        VideoListResponse videoListResponse = new VideoListResponse();
                        videoListResponse = videoFacade.GetUploadedVideoList(videoListRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(videoListResponse);
                        systemFacade.Log("0", "1", "1", "getloadvideolist", 1);
                        break;
                    case "getuploadedvideobyid":
                        log.Debug("EnglishRemix2, Action: getuploadedvideobyid");
                        GetUploadedVideoRequest getUploadedVideoRequest = new JavaScriptSerializer().Deserialize<GetUploadedVideoRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), getUploadedVideoRequest.VideoId.ToString(), "0", "0");
                        GetUploadedVideoResponse getUploadedVideoResponse = new GetUploadedVideoResponse();
                        getUploadedVideoResponse = videoFacade.GetUploadedVideoById(getUploadedVideoRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(getUploadedVideoResponse);
                        systemFacade.Log("0", "1", "1", "getuploadedvideobyid", 1);
                        break;
                    case "postcomment":
                        log.Debug("EnglishRemix2, Action:postcomment");
                        PostCommentRequest postCommentRequest = new JavaScriptSerializer().Deserialize<PostCommentRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), postCommentRequest.CreatorId.ToString(), postCommentRequest.ToCommentId.ToString(), postCommentRequest.UserVideoId.ToString());
                        PostCommentResponse postCommentResponse = videoFacade.PostComment(postCommentRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(postCommentResponse);
                        systemFacade.Log("0", "1", "1", postCommentResponse.Message, 1);
                        break;
                    case "getcommentbyuploadedvideoid":
                        log.Debug("EnglishRemix2, Action:getcommentbyuploadedvideoid");
                        CommentRequest commentRequest = new JavaScriptSerializer().Deserialize<CommentRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), commentRequest.UploadedVideoId.ToString(), "0", "0");
                        CommentResponse commentResponse = videoFacade.GetCommentByUploadedVideoId(commentRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(commentResponse);
                        systemFacade.Log("0", "1", "1", "allcomments", 1);
                        break;
                    case "rateuploadedvideo":
                        log.Debug("EnglishRemix2, Action:rateuploadedvideo");
                        RateUploadedVideoRequest rateRequest = new JavaScriptSerializer().Deserialize<RateUploadedVideoRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), rateRequest.CreatorId.ToString(), rateRequest.VideoId.ToString(), rateRequest.Score.ToString());
                        RateUploadedVideoResponse rateResponse = videoFacade.RateUploadedVideo(rateRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(rateResponse);
                        systemFacade.Log("0", "1", "1", rateResponse.Message, 1);
                        break;
                    case "getrankingvideo":
                        log.Debug("EnglishRemix2, Action:getrankingvideo");
                        GetRankingVideoRequest getrankingvideorequest = new JavaScriptSerializer().Deserialize<GetRankingVideoRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), getrankingvideorequest.Score.ToString(), getrankingvideorequest.Ranking.ToString(), "0");
                        GetRankingVideoResponse getrankingvideoresponse = videoFacade.GetRankingVideo(getrankingvideorequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(getrankingvideoresponse);
                        systemFacade.Log("0", "1", "1", "rankingvideos", 1);
                        break;
                    case "purchasecoin":
                        log.Debug("EnglishRemix2, Action: purchaseCoin, serializeRequestData: " + serializedRequestData);
                        PurchaseCoinsRequest purchaseCoinRequest = new JavaScriptSerializer().Deserialize<PurchaseCoinsRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), purchaseCoinRequest.PurchasedCoin.ToString(), "0", "0");
                        PurchaseCoinsResponse purhcaseCoinResp = new PurchaseCoinsResponse();
                        purhcaseCoinResp = userFacade.PurchaseCoin(purchaseCoinRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(purhcaseCoinResp);
                        systemFacade.Log("0", "1", "1", "purchasecoin", 1);
                        break;
                    case "getpurchaseproduct":
                        log.Debug("EnglishRemix2, Action: getPurhcaseProduct");
                        PurchaseProductRequest purchaseRequest = new JavaScriptSerializer().Deserialize<PurchaseProductRequest>(serializedRequestData);
                        systemFacade.AddUserAction(request.UserId, request.MethodName.ToLower(), "0", "0", "0");
                        PurchaseProductResponse purchaseResp = new PurchaseProductResponse();
                        purchaseResp = systemFacade.GetPurchaseProduct(purchaseRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(purchaseResp);
                        systemFacade.Log("0", "1", "1", "gerpurchaseproduct", 1);
                        break;
                    case "getuseractionbyid":
                        //for debugging purpose
                        log.Debug("EnglishRemix2, Action: getUserActionById-debugging");
                        GetUserActionRequest getUserActionRequest = new JavaScriptSerializer().Deserialize<GetUserActionRequest>(serializedRequestData);
                        GetUserActionResponse getUserActionResp = new GetUserActionResponse();
                        getUserActionResp = userFacade.GetUserActionById(getUserActionRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(getUserActionResp);
                        systemFacade.Log("0", "1", "1", "getuseractionbyid", 1);
                        break;
                    case "getactiontype":
                        //for debugging purpose
                        log.Debug("EnglishRemix1, Action: getActionType-debugging");
                        ActionTypeRequest actionTypeRequest = new JavaScriptSerializer().Deserialize<ActionTypeRequest>(serializedRequestData);
                        ActionTypeResponse actionTypeResp = new ActionTypeResponse();
                        actionTypeResp = systemFacade.GetActionType(actionTypeRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(actionTypeResp);
                        systemFacade.Log("0", "1", "1", "getactiontype", 1);
                        break;
                    case "adduserachievement":
                        //Add User Achievement
                        log.Debug("EnglishRemix2, Action: addUserAchievement-debugging");
                        AddAchievementRequest addAchievementRequest = new JavaScriptSerializer().Deserialize<AddAchievementRequest>(serializedRequestData);
                        AddAchievementResponse addAchievementResp = new AddAchievementResponse();
                        addAchievementResp = systemFacade.AddUserAchievement(addAchievementRequest);
                        response.ResponseData = new JavaScriptSerializer().Serialize(addAchievementResp);
                        systemFacade.Log("0", "1", "1", "addAchievement", 1);
                        break;
                    default:
                        //To catch the method name wrong input
                        throw new ServiceException("Method name is wrong. Current method name is " + request.MethodName);
                }
            }
            catch (ServiceException e)
            {
                // Catch service exception and return its response to the user.
                response = e.response;

                if (!request.UserId.Equals(""))
                    systemFacade.Log(request.UserId, "1", "1", e.response.ErrorMsg, 1);
                else
                    systemFacade.Log("0", "1", "1", e.response.ErrorMsg, 1);

                return response;
            }
            catch (Exception e)
            {
                // Catch unknown/sql exception
                response.HasError = true;
                response.ErrorMsg = e.ToString();
                if (!request.UserId.Equals(""))
                    systemFacade.Log("0", "1", "1", e.Message, 1);
                else
                    systemFacade.Log("0", "1", "1", e.Message, 1);
                return response;
            }

            response.HasError = false;
            return response;
        }