protected function saveObject($data, $allowCustomShopId)
    {
        $shopObject = $this->createShopObject();

        foreach ($data as $key => $value) {
            // change case to UPPER
            $uppercaseKey = strtoupper($key);
            if (!isset($data[$uppercaseKey])) {
                unset($data[$key]);
                $data[$uppercaseKey] = $value;
            }
        }

        if (method_exists($shopObject, 'setForceCoreTableUsage')) {
            $shopObject->setForceCoreTableUsage(true);
        }

        $isLoaded = false;
        if ($data['OXID']) {
            $isLoaded = $shopObject->load($data['OXID']);
        }

        $data = $this->preAssignObject($shopObject, $data, $allowCustomShopId);

        if ($isLoaded) {
            $this->checkWriteAccess($shopObject, $data);
        } else {
            $this->checkCreateAccess($data);
        }

        $shopObject->assign($data);

        if ($allowCustomShopId) {
            $shopObject->setIsDerived(false);
        }

        if ($this->preSaveObject($shopObject, $data)) {
            // store
            if ($shopObject->save()) {
                return $this->postSaveObject($shopObject, $data);
            }
        }

        return false;
    }