/// <inheritdoc /> public async Task <BranchMin> GetAnyBranchAsync(BranchMinRequestModel requestModel) { if (requestModel == null) { throw new ArgumentNullException(nameof(requestModel)); } Branch branch = null; if (requestModel.Id.HasValue) { branch = await _branchRepository.GetAnyBranchAsync(requestModel.Id.Value); } else { branch = await _branchRepository.GetByAsync(x => x.BranchName == requestModel.BranchName); } if (branch == null) { throw new KeyNotFoundException(); } return(branch.Adapt <BranchMin>()); }