public function store()
    {
        // Check whether the object has ever been stored.
        if ($this->isNew) {
            Logger::get()->debug('Storing new entity ' . get_class($this) . '...');
            // Create the record. Get an ID back.
            $this->id = $this->getDataSource()->create($this->getFieldsData());
            // Store this object in the appropriate factory for further use.
            $this->getFactory()->registerEntity($this);
        } else {
            Logger::get()->debug('Updating entity ' . get_class($this) . ":{$this->id}...");
            $this->getDataSource()->update($this->id, $this->getFieldsData());
        }

        // Once stored, the entity is no longer new.
        $this->isNew = false;
    }