public async Task ValidateNotDeletedById <T>(IBaseDao <T> dao, long id) where T : BaseEntity <T> { if (!await dao.ExistAndNotDeletedByIdAsync(id)) { var invalidEntityIdException = new InvalidEntityIdException(id, "Entity with this id does not exist!"); Logger.Error(invalidEntityIdException, "{type} with {id} does not exist!", typeof(T), id); throw invalidEntityIdException; } }