public HttpResponseMessage UnlockStockWithdrawal(String id)
        {
            try
            {
                var currentUser = from d in db.MstUsers where d.UserId == User.Identity.GetUserId() select d;
                if (currentUser.Any())
                {
                    Int32 currentUserId   = currentUser.FirstOrDefault().Id;
                    Int32 currentBranchId = currentUser.FirstOrDefault().BranchId;

                    IQueryable <Data.MstUserForm>        userForms       = from d in db.MstUserForms where d.UserId == currentUserId && d.SysForm.FormName.Equals("StockWithdrawalDetail") select d;
                    IQueryable <Data.TrnStockWithdrawal> stockWithdrawal = from d in db.TrnStockWithdrawals where d.Id == Convert.ToInt32(id) select d;

                    Boolean isValid       = false;
                    String  returnMessage = "";

                    if (!userForms.Any())
                    {
                        returnMessage = "Sorry. You have no access for this stock withdrawal page..";
                    }
                    else if (!userForms.FirstOrDefault().CanUnlock)
                    {
                        returnMessage = "Sorry. You have no rights to unlock stock withdrawal.";
                    }
                    else if (!stockWithdrawal.Any())
                    {
                        returnMessage = "Data not found. These stock withdrawal details are not found in the server.";
                    }
                    else if (!stockWithdrawal.FirstOrDefault().IsLocked)
                    {
                        returnMessage = "Unlocking Error. These stock withdrawal details are already unlocked.";
                    }
                    else
                    {
                        isValid = true;
                    }

                    if (isValid)
                    {
                        var unlockStockWithdrawal = stockWithdrawal.FirstOrDefault();
                        unlockStockWithdrawal.IsLocked        = false;
                        unlockStockWithdrawal.UpdatedById     = currentUserId;
                        unlockStockWithdrawal.UpdatedDateTime = DateTime.Now;
                        db.SubmitChanges();

                        // =====================
                        // Journal and Inventory
                        // =====================
                        Business.Journal   journal   = new Business.Journal();
                        Business.Inventory inventory = new Business.Inventory();

                        if (!unlockStockWithdrawal.IsLocked)
                        {
                            journal.DeleteStockWithdrawalJournal(Convert.ToInt32(id));
                            inventory.DeleteStockWithdrawalInventory(Convert.ToInt32(id));
                        }

                        return(Request.CreateResponse(HttpStatusCode.OK));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.BadRequest, returnMessage));
                    }
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, "Theres no current user logged in."));
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Something's went wrong from the server."));
            }
        }