public function store(Request $request)
    {
        $data = $request->all();

        // check permissions
        if(isset($data['postID'])) {
            if(!User::hasAccess($request->postType, 'update', $data['postID'], true)) {
                return $this->noPermission();
            }
        }else{
            if(!User::hasAccess($request->postType, 'create')) {
                return $this->noPermission();
            }
        }

        $results = $this->fillEmptyTitles($data);
        $data = $results['data'];
        $firstFilledTitle = $results['firstFilledTitle'];

        // generate a unique slug
        $postID = 0;
        if(isset($data['postID'])) {
            $postID = $data['postID'];
        }

        $data['slug'] = $this->fillEmptySlugs($data['slug'], $data['postType'], $firstFilledTitle, $postID);

        try{
            $postResult = Post::store($data);

            if($postResult['error']) {
                if(isset($postResult['errorMessages'])) {
                    $result = $this->response("Please fill all required fields in all languages", 400, null, false, false, true, $postResult['errorMessages'], $postResult['noty']);
                }else{
                    $result = $this->response('You post could not be saved. Please try again later', 500, null, false, false, false, [], $postResult['noty']);
                }
            }else{
                $redirectParams = self::redirectParams($request->redirect, $postResult['postType'], $postResult['postID']);
                $result = $this->response('Your post was successfully saved', 200, $postResult['postID'], $redirectParams['view'], $redirectParams['redirectUrl'], false, [], $postResult['noty']);
            }

        }catch(\Exception $e){
            $result = $this->response($e->getMessage(), 500, null, false, false, false, [], []);
        }

        return $result;
    }