func (controller *HomeController) EditPost(productVM *ProductVM) mvc.ActionResultInterface {
	if len(productVM.Name) == 0 {
		productVM.Error = "Name can't be empty"
		return mvc.ShowView("", "", productVM)
	}

	productToUpdate := controller.findProduct(productVM.ProductId)
	isNewProduct := false
	if productToUpdate == nil {
		isNewProduct = true
		productAddSync.Lock()
		defer productAddSync.Unlock()

		productToUpdate = &Product{len(products) + 1, "", ""}
		products = append(products, productToUpdate)
	}

	productToUpdate.Name = productVM.Name
	productToUpdate.Description = productVM.Description

	if isNewProduct {
		return mvc.RedirectToAction("", "list", nil)
	}

	return mvc.ShowView("", "", ProductVMFromProduct(productToUpdate))
}
func (provider *AuthProvider) IsAccessAllowed(
	c mvc.Controller,
	a mvc.Action,
	response http.ResponseWriter,
	request *http.Request) mvc.ActionResultInterface {

	if (c == names.C.Home && a == names.A.Home.Index) ||
		(c == names.C.Account && a == names.A.Account.Login) {
		return nil
	}

	if !provider.IsAuthenticated(request) {
		return mvc.RedirectToAction(names.C.Home, names.A.Home.Index,
			map[string]string{"Restricted": "true"})
	}

	return nil
}