public ActionResult Delete(int id, FormCollection collection)
        {
            // Get the product IDs.
            IEnumerable <ProductXInvoiceDto> xInvoices = getProductXInvoices(id);             foreach (ProductXInvoiceDto product in xInvoices)

            {
                string url = ControllersHelper.getUrl("ProductXInvoice", "Delete", product.id);
                helper.doPostRequest(url, "");
            }

            // TODO: do something with the response.
            helper.doPostRequest(getUrl("Delete", id), "");
            return(RedirectToAction("Index"));
        }
 // A utility function that facilitates the call to the helper to retrieve a Product from the database.
 private ProductDto getProductDto(int productId)
 {
     return(productsHelper.doGetAndGetFromResponse <ProductDto>(productsHelper.getUrl("Get", productId)));
 }
 // A utility function to save a few characters when using the ControllersHelper to construct a url.
 private string getUrl(string action, int id = 0)
 {
     return(helper.getUrl(action, id));
 }
 // A utility function that facilitates the call to the helper to retrieve a list of ProductXInvoices from the database.
 private IEnumerable <ProductXInvoiceDto> getProductXInvoices(int invoiceId)
 {
     return(xInvoiceHelper.doGetAndGetFromResponse <IEnumerable <ProductXInvoiceDto> >(xInvoiceHelper.getUrl("Get", 0) + "s/" + invoiceId));
 }