public function load($properties = array())
    {
        $keys = $this->getIdentifyingData();

        if (empty($keys)) {
            throw new AnDomainEntityException('Trying to load an entity without any identifying data');
        }

        //prevent from creating two differne entities
        if (!$this->_persisted) {
            //if found another entity
            $entity = $this->getRepository()->find($keys, false);

            if ($entity && $entity !== $this) {
                $this->reset();

                return $entity->load($properties);
            }
        }

        settype($properties, 'array');

        if (empty($properties)) {
            //only load serializbale properties (i.e. attributes, many to one relationships)
            $properties = array();

            foreach ($this->getEntityDescription()->getProperty() as $property) {
                if ($property->isSerializable()) {
                    $properties[] = $property->getName();
                }
            }

            $keys = array_keys($this->getEntityDescription()->getIdentifyingProperties());
            $properties = array_diff($properties, $keys);
        }

        if ($this->_data->load($properties)) {
            //enttiy has been fetched for the first time
            if (!$this->_persisted) {
                $keys = $this->getIdentifyingData();
                $this->_persisted = true;
                $this->getRepository()->getSpace()->insertEntity($this, $keys);
                $this->reset();
            } else {
                //the loaded properties are no longer modified
                foreach ($properties as $property) {
                    unset($this->_modified[$property]);
                }

                //reset the element if there are no modified
                if (count($this->_modified) === 0) {
                    $this->reset();
                }
            }
        } else {
            //if a persisted entity can not be loaded then
            //it must mean the data doesn't exists in the store
            //can we assume then the data has been somehow deleted ?
            //if that's the case then we need to set the state to destroyed
            if ($this->persisted()) {
                $this->getRepository()->getSpace()->setEntityState($this, AnDomain::STATE_DESTROYED);
            } else {
                $this->reset();
            }
        }

        return $this;
    }