public function postIndex()
    {
        $oInput     = Factory::service('Input');
        $oHttpCodes = Factory::service('HttpCodes');

        $this->userCan(static::ACTION_CREATE);

        /**
         * First check the $_POST superglobal, if that's empty then fall back to
         * the body of the request assuming it is JSON.
         */
        $aData = $oInput->post();
        if (empty($aData)) {
            $sData = stream_get_contents(fopen('php://input', 'r'));
            $aData = json_decode($sData, JSON_OBJECT_AS_ARRAY) ?: [];
        }

        $aData   = $this->validateUserInput($aData);
        $iItemId = $this->oModel->create($aData);

        if (empty($iItemId)) {
            throw new ApiException(
                'Failed to create resource. ' . $this->oModel->lastError(),
                $oHttpCodes::STATUS_INTERNAL_SERVER_ERROR
            );
        }

        $oItem = $this->oModel->getById($iItemId, static::CONFIG_LOOKUP_DATA);

        $oResponse = Factory::factory('ApiResponse', 'nails/module-api');
        $oResponse->setData($this->formatObject($oItem));

        return $oResponse;
    }