Here you have an excellent way to make the function a little more readable:

    if (!attr.hasField(ENT_ATTRS_MD))
      return false;

    ....

And the 'return false' before this one would look a lot better without 'else'.