public IActionResult Delete(EntityViewModel vm)
        {
            bool errorMessageSet = false;
            var  userID          = User.FindFirstValue(ClaimTypes.NameIdentifier);

            //Check for absorption vendor selection.
            if (vm.AbsorptionEntity.EntityID != 0)
            {
                //Make sure the user owns both the absorbed and absorbing vendors
                if (!_vendorRepository.UserOwnsVendor(vm.EntityOfInterest.EntityID, userID) ||
                    !_vendorRepository.UserOwnsVendor(vm.AbsorptionEntity.EntityID, userID))
                {
                    //TODO: Perhaps a more specific message to the user?
                    return(NotFound());
                }

                //Convert the VMVendors to DBVendors
                Vendor absorbedVendor  = _vendorRepository.Get(vm.EntityOfInterest.EntityID, userID);
                Vendor absorbingVendor = _vendorRepository.Get(vm.AbsorptionEntity.EntityID, userID);

                //Ensure that the deleted vendor is not default.
                if (!absorbedVendor.IsDefault)
                {
                    //Make sure the absorbing vendor and the deleting vendor are not the same.
                    if (absorbedVendor.VendorID != absorbingVendor.VendorID)
                    {
                        //Update all transactions that currently point to the vendor being deleted to instead point to the absorbing vendor.
                        _vendorRepository.Absorption(absorbedVendor.VendorID, absorbingVendor.VendorID, userID);

                        //Delete the vendor to be deleted.
                        _vendorRepository.Delete(absorbedVendor.VendorID);

                        TempData["Message"] = "Vendor successfully deleted.";

                        return(RedirectToAction("Index"));
                    }
                    SetErrorMessage(vm, "Vendor being deleted and vendor absorbing cannot be the same.", errorMessageSet);
                    errorMessageSet = true;
                }
                SetErrorMessage(vm, "Deleting a default vendor is not allowed.", errorMessageSet);
                errorMessageSet = true;
            }
            SetErrorMessage(vm, "You must select a vendor to absorb transactions related to the vendor being deleted.", errorMessageSet);

            EntityViewModel failureStateVM = new EntityViewModel();

            failureStateVM.EntityOfInterest = vm.EntityOfInterest;
            failureStateVM.VendorSelectList = failureStateVM.InitVendorSelectList(_vendorRepository, userID);
            return(View(failureStateVM));
        }