Improve findByAttributes/getByAttributes behaviour

findByAttributes will return null if array of attributes is empty.

getByAttributes will throw an InvalidArgumentException.
add @throws for getByAttributes