public static function getIncludedData(
        $primaryData,
        $include = [],
        Fields $fields = null,
        $additionalResourceParameters = []
    ) {
        /**
         * Store relationshipKeys as key and ids of their related data as value
         * @example
         * ```php
         * (object) [
         *     'author'  => [1],
         *     'comment' => [1, 2, 3, 4]
         * ]
         * ```
         */
        $tempRelationshipIds = new \stdClass();

        //check if relationship exists
        foreach ($include as $relationshipKey) {
            if (!static::relationshipExists($relationshipKey)) {
                throw new RequestException(sprintf(
                    'Relationship "%s" not found',
                    $relationshipKey
                ));
            }

            //Will hold ids of related data
            $tempRelationshipIds->{$relationshipKey} = [];
        }

        if (empty($include) || empty($primaryData)) {
            return [];
        }

        //iterate all primary data

        //if a single resource convert it to array
        //so it can be iterated in the same way
        if (!is_array($primaryData)) {
            $primaryData = [$primaryData];
        }

        foreach ($primaryData as $resource) {
            //Ignore resource if it's relationships are not set or empty
            if (empty($resource->relationships)) {
                continue;
            }

            foreach ($include as $relationshipKey) {
                //ignore if requested relationship is not set
                if (!isset($resource->relationships->{$relationshipKey})) {
                    continue;
                }

                //ignore if requested relationship data are not set
                if (!isset($resource->relationships->{$relationshipKey}->data)) {
                    continue;
                }

                $relationshipData = $resource->relationships->{$relationshipKey}->data;

                if (!$relationshipData || empty($relationshipData)) {
                    continue;
                }

                //if single relationship resource convert it to array
                //so it can be iterated in the same way
                if (!is_array($relationshipData)) {
                    $relationshipData = [$relationshipData];
                }

                //Push relationship id for this requested relationship
                foreach ($relationshipData as $primaryKeyAndType) {
                    //push primary key (use type? $primaryKeyAndType->type)
                    $tempRelationshipIds->{$relationshipKey}[] = $primaryKeyAndType->id;
                }
            }
        }

        $included = [];

        foreach ($include as $relationshipKey) {
            $relationship = static::getRelationship($relationshipKey);

            $relationshipModelClass = $relationship->modelClass;

            $ids = array_unique($tempRelationshipIds->{$relationshipKey});

            $additionalArgument = (
                isset($additionalResourceParameters[$relationshipKey])
                ? $additionalResourceParameters[$relationshipKey]
                : []
            );

            $resources = $relationshipModelClass::getById(
                $ids,
                $fields,
                ...$additionalArgument
            );

            foreach ($resources as $key => $resource) {
                if ($resource === null) {
                    continue;
                }

                $included[] = $resource;
            }
        }

        return $included;
    }