public ActionResult DeleteResource(ResourceListViewModel res)
        {
            var itemID     = res.EditItemID;
            var categoryID = res.DeleteCategoryID;


            //A resource will be allowed in mulitple categories Thus delete this entries from this table
            var categoryItems = ExigoDAL.GetResourceCategoryItems(new GetResourceCategoryItemsRequest()
            {
                ItemID = itemID
            });

            foreach (var item in categoryItems)
            {
                //2015-09-08
                //Ivan S.
                //66
                //Reorders the following resources (setting their order to a minus 1 value)
                var itemOrder         = item.ItemOrder;
                var categoryItemOrder = ExigoDAL.GetResourceCategoryItems(new GetResourceCategoryItemsRequest()
                {
                    CategoryID = categoryID, ItemOrder = itemOrder
                }).ToList();
                foreach (var catitem in categoryItemOrder)
                {
                    catitem.ItemOrder = catitem.ItemOrder - 1;
                    ExigoDAL.ModifyResourceCategoryItemOrder(catitem);
                }
            }
            //Delete the availabilitiy of the resource
            var availability = ExigoDAL.GetResourceAvailabilities(new GetResourceAvailabilitiesRequest()
            {
                ItemID = itemID
            }).Select(v => v.AvailabilityID).ToList();

            ExigoDAL.DeleteResourceAvailabilities(availability);

            //Delete The Tags Associated with the item
            var tags = ExigoDAL.GetResourceItemTags(new GetResourceItemTagsRequest()
            {
                ItemID = itemID
            }).Select(t => t.TagID).ToList();

            ExigoDAL.DeleteResourceItemTags(tags);

            //Delete the resource itself
            var resource = ExigoDAL.GetResourceItems(new GetResourcesRequest()
            {
                ItemID = itemID
            }).FirstOrDefault();

            ExigoDAL.DeleteResourceItem(resource);

            return(RedirectToAction("ManageResources"));
        }