public HttpResponseMessage Atualizar(HttpRequestMessage request, EstoqueViewModel estoqueViewModel)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest,
                                                      ModelState.Keys.SelectMany(k => ModelState[k].Errors)
                                                      .Select(m => m.ErrorMessage).ToArray());
                }
                else
                {
                    Estoque novoItemEstoque = _estoqueRep.GetSingle(estoqueViewModel.Id);

                    Usuario usuario = _usuarioRep.GetSingle(int.Parse(HttpContext.Current.User.Identity.GetUserId()));

                    novoItemEstoque.AtualizarEstoque(estoqueViewModel, usuario);

                    _unitOfWork.Commit();

                    // Update view model
                    estoqueViewModel = Mapper.Map <Estoque, EstoqueViewModel>(novoItemEstoque);

                    response = request.CreateResponse(HttpStatusCode.OK, estoqueViewModel);
                }

                return response;
            }));
        }