Added entity validation and tests