public static function buildExceptionStore(\Exception $e)
    {
        $exceptionStore = new ExceptionStore();
        $exceptionStore->setMessage($e->getMessage());
        $exceptionStore->setCode($e->getCode());
        $exceptionStore->setExceptionClass(get_class($e));
        $t = explode('\n', $e->getTraceAsString());
        $exceptionStore->setStack($t);

        $stack = $e->getTrace();
        if (count($stack) > 0) {
            //Setting default unknown values
            $exceptionStore->setFile("unknown");
            $exceptionStore->setLine(0);
            //Searching for a valid stackItem
            $stackItem = static::searchForFileAndLineCalledFromStack($stack);
            if (!is_null($stackItem)) {
                $exceptionStore->setFile(basename($stackItem['file'],'.php'));
                $exceptionStore->setLine($stackItem['line']);
            }
        }

        return $exceptionStore;
    }