Check domain object is valid

Closes #302

If the fetched DomainObject is not valid, an exception is thrown;

Minor refactor on the method code.