private async Task ValidationByBranche(Guid?branchId, string token) { if (!branchId.HasValue) { throw new ApplicationException($"{nameof(branchId)} is required for this role"); } var branch = await _httpService.GetBranchById(branchId.Value, token); if (branch == null) { throw new ApplicationException($"Branch with id: {branchId.Value.ToString()} is not exist"); } if (!branch.CompanyId.HasValue) { throw new ApplicationException($"Branch not connected anyone company"); } var company = await _httpService.GetCompanyById(branch.CompanyId.Value, token); if (company == null) { throw new ApplicationException($"Company from branch is not exist"); } }