Import validation

Added validation to entity import and dataset import.
Did some refactor.