public static function processInPieces($strCountQuery, $strQuery, $callback = null, $strKey = null, $intBulkSize = 5000)
    {

        $objTotal = \Database::getInstance()->execute($strCountQuery);

        if ($objTotal->total < 1)
        {
            return false;
        }

        $intBulkSize = intval($intBulkSize);
        $intTotal    = $objTotal->total;
        $intCycles   = $intTotal / $intBulkSize;

        for ($i = 0; $i <= $intCycles; $i++)
        {
            $objResult = \Database::getInstance()->prepare($strQuery)->limit($intBulkSize, $i * $intBulkSize)->execute();

            if ($objResult->numRows < 1)
            {
                return false;
            }

            if (is_callable($callback))
            {
                $arrReturn = [];

                while (($arrRow = $objResult->fetchAssoc()) !== false)
                {
                    if ($strKey)
                    {
                        $arrReturn[$arrRow[$strKey]] = $arrRow;
                        continue;
                    }

                    $arrReturn[] = $arrRow;
                }

                call_user_func_array($callback, [$arrReturn]);
            }
        }

        return $intTotal;
    }