/// <summary> /// Returns whether or not an element is in-use. An element is considered in-use if it exists on a page or master page. /// </summary> /// <param name="tenantId">Tenant identifying a website.</param> /// <param name="elementId">Element identifier.</param> /// <param name="unitOfWork">Unit of work.</param> /// <returns>True if element on master page or page, false if not.</returns> private bool ElementInUse(long tenantId, long elementId, IUnitOfWork unitOfWork) { int count = _pageRepository.GetElementPageCount(tenantId, elementId, unitOfWork); if (count == 0) { count = _masterPageRepository.GetElementMasterPageCount(tenantId, elementId, unitOfWork); } return(count > 0); }