public ActionResult <JsonResponse> DeleteNavLinkMethod(int admin_id, string admin_token, int site_id, int link_id) { if (authenticator.VerifyAdminForLeaf(admin_id, site_id, admin_token)) { List <NavLink> found_nav_links; try{ found_nav_links = dbQuery.QueryNavBarLinksBySiteId(site_id); }catch { return(StatusCode(400, $"Link ID {link_id} not found on site id {site_id}'s Nav Bar")); } NavLink found_link = null; foreach (NavLink link in found_nav_links) { if (link.link_id == link_id) { found_link = link; } } if (found_link == null) { return(StatusCode(400, $"Link ID {link_id} not found on site id {site_id}'s Nav Bar")); } _dataLimiter.RemoveNavLinkFromDataPlan(found_link, admin_id); dbQuery.DeleteNavLinkById(link_id); return(new JsonSuccess($"NavLink Deleted for link id: {link_id}")); } else { JsonFailure f = new JsonFailure("Invalid credentials."); return(StatusCode(400, f)); } }