You can avoid all the else
statements by rearranging your if
statements. Also, I would simply return false
if the account Id does not exist. It's not a good idea to control program flow by throwing exceptions and catching them elsewhere in your code. My suggestion, for what it's worth, would be something like this.
private static bool IsAccountActive(Guid accountId)
{
if (accountId == null)
{
throw new ArgumentException("Parameter cannot be null", "accountId");
}
if (!AccountIdExists(accountId))
{
return false;
}
AccountInfo acctInfo = RetrieveAccountInformation(accountId);
return acctInfo.AccountActive;
}