diff --git a/lib/classes/JsonApi/Schemas/BlubberStatusgruppeThread.php b/lib/classes/JsonApi/Schemas/BlubberStatusgruppeThread.php
index 484cb6929c90c944dac2543a3f812d9f8d0ec02a..76651e4af7e4058adf148bc0cfefdf92a3fd7455 100644
--- a/lib/classes/JsonApi/Schemas/BlubberStatusgruppeThread.php
+++ b/lib/classes/JsonApi/Schemas/BlubberStatusgruppeThread.php
@@ -17,9 +17,6 @@ class BlubberStatusgruppeThread extends BlubberThread
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = parent::getRelationships($resource, $context);
 
         $relationships[self::REL_STATUSGRUPPE] = [
diff --git a/lib/classes/JsonApi/Schemas/CalendarEvent.php b/lib/classes/JsonApi/Schemas/CalendarEvent.php
index 3ee6ab5f34b59b683790bbb831eccfdac20e8ad1..7b348d5478d8a456eb38abafaf64196376372cf4 100644
--- a/lib/classes/JsonApi/Schemas/CalendarEvent.php
+++ b/lib/classes/JsonApi/Schemas/CalendarEvent.php
@@ -37,9 +37,6 @@ class CalendarEvent extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         if ($owner = $resource->getOwner()) {
diff --git a/lib/classes/JsonApi/Schemas/Course.php b/lib/classes/JsonApi/Schemas/Course.php
index 98c890916f49e6125e3c46b9f785a8a47744f8be..42fcfd2fd00b37704fec62aa1e10a04e0d2f8cf0 100644
--- a/lib/classes/JsonApi/Schemas/Course.php
+++ b/lib/classes/JsonApi/Schemas/Course.php
@@ -55,10 +55,8 @@ class Course extends SchemaProvider
 
     public function getRelationships($course, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
         $includeList = $context->getIncludePaths();
 
-
         $relationships = [];
 
         $relationships[self::REL_INSTITUTE] = $this->getInstitute($course, in_array(self::REL_INSTITUTE, $includeList));
diff --git a/lib/classes/JsonApi/Schemas/CourseEvent.php b/lib/classes/JsonApi/Schemas/CourseEvent.php
index d2ec52dd6b6673622387b9f8277ebed56cd0c867..77f1d3157f40023c3359d25935c39227af381317 100644
--- a/lib/classes/JsonApi/Schemas/CourseEvent.php
+++ b/lib/classes/JsonApi/Schemas/CourseEvent.php
@@ -36,9 +36,6 @@ class CourseEvent extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         if ($owner = $resource->course) {
diff --git a/lib/classes/JsonApi/Schemas/CourseMember.php b/lib/classes/JsonApi/Schemas/CourseMember.php
index 1997e8b7d02649173a68ae99823833f7dff0e1d2..e68264072c8e1bb8cec2389771095b59bbd88b83 100644
--- a/lib/classes/JsonApi/Schemas/CourseMember.php
+++ b/lib/classes/JsonApi/Schemas/CourseMember.php
@@ -45,7 +45,6 @@ class CourseMember extends SchemaProvider
     public function getRelationships($membership, ContextInterface $context): iterable
     {
         $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
 
         $relationships = [];
 
diff --git a/lib/classes/JsonApi/Schemas/Courseware/Block.php b/lib/classes/JsonApi/Schemas/Courseware/Block.php
index ba3e21fea6952342a8c9fd08f56eada3431d9a78..63fd96e47c6892c1d9b96b0074cdbe3f9262b947 100755
--- a/lib/classes/JsonApi/Schemas/Courseware/Block.php
+++ b/lib/classes/JsonApi/Schemas/Courseware/Block.php
@@ -51,9 +51,6 @@ class Block extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         $relationships[self::REL_COMMENTS] = [
diff --git a/lib/classes/JsonApi/Schemas/Courseware/BlockComment.php b/lib/classes/JsonApi/Schemas/Courseware/BlockComment.php
index c2abd5bf1b74c5bf77aefb885badaeaa06d09db8..aac1bd042fdb4538c952f280f57e020824a91620 100755
--- a/lib/classes/JsonApi/Schemas/Courseware/BlockComment.php
+++ b/lib/classes/JsonApi/Schemas/Courseware/BlockComment.php
@@ -38,9 +38,6 @@ class BlockComment extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         $relationships[self::REL_BLOCK] = [
diff --git a/lib/classes/JsonApi/Schemas/Courseware/BlockFeedback.php b/lib/classes/JsonApi/Schemas/Courseware/BlockFeedback.php
index b5992b7c2e096257cd86d3634faf8a8be1822553..7152c8a13e71e2bc4720ed2b830cc43cabbb9b13 100755
--- a/lib/classes/JsonApi/Schemas/Courseware/BlockFeedback.php
+++ b/lib/classes/JsonApi/Schemas/Courseware/BlockFeedback.php
@@ -38,9 +38,6 @@ class BlockFeedback extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         $relationships[self::REL_BLOCK] = [
diff --git a/lib/classes/JsonApi/Schemas/Courseware/Instance.php b/lib/classes/JsonApi/Schemas/Courseware/Instance.php
index 2fba0e3995b0485ba7670cf25b5d7b846b1285cb..055c387defd8ca4e76ea3ad55cbecf062cb8a056 100755
--- a/lib/classes/JsonApi/Schemas/Courseware/Instance.php
+++ b/lib/classes/JsonApi/Schemas/Courseware/Instance.php
@@ -71,9 +71,6 @@ class Instance extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         $user = $this->currentUser;
diff --git a/lib/classes/JsonApi/Schemas/Courseware/UserDataField.php b/lib/classes/JsonApi/Schemas/Courseware/UserDataField.php
index 810e870ce2c80d4a635d9d937082032e3c210755..d00f64d8833b7632dadffbe50f277e4d65383880 100755
--- a/lib/classes/JsonApi/Schemas/Courseware/UserDataField.php
+++ b/lib/classes/JsonApi/Schemas/Courseware/UserDataField.php
@@ -38,9 +38,6 @@ class UserDataField extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         $relationships[self::REL_BLOCK] = [
diff --git a/lib/classes/JsonApi/Schemas/Courseware/UserProgress.php b/lib/classes/JsonApi/Schemas/Courseware/UserProgress.php
index 5d6e68a5bfea4d798e114ba6da6d10723a508d74..f5493a869ed94092f2e4995847b81e2f49c9db4f 100755
--- a/lib/classes/JsonApi/Schemas/Courseware/UserProgress.php
+++ b/lib/classes/JsonApi/Schemas/Courseware/UserProgress.php
@@ -38,9 +38,6 @@ class UserProgress extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         $relationships[self::REL_BLOCK] = [
diff --git a/lib/classes/JsonApi/Schemas/File.php b/lib/classes/JsonApi/Schemas/File.php
index 8293b5fc1cd75554c4bc526f0f68844af2b7c075..8eb80469da259d2698aa913a4f7ba373fd4d69eb 100644
--- a/lib/classes/JsonApi/Schemas/File.php
+++ b/lib/classes/JsonApi/Schemas/File.php
@@ -44,7 +44,6 @@ class File extends SchemaProvider
     public function getRelationships($resource, ContextInterface $context): iterable
     {
         $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
 
         $relationships = [];
 
diff --git a/lib/classes/JsonApi/Schemas/FileRef.php b/lib/classes/JsonApi/Schemas/FileRef.php
index 5da46f6d475fc566540bc7fb586cb40fc25dd44e..d979537ed884ba61ff4d534f3f2723e1bae0017a 100644
--- a/lib/classes/JsonApi/Schemas/FileRef.php
+++ b/lib/classes/JsonApi/Schemas/FileRef.php
@@ -75,9 +75,6 @@ class FileRef extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         $relationships = $this->getFeedbackRelationship($relationships, $resource);
diff --git a/lib/classes/JsonApi/Schemas/Folder.php b/lib/classes/JsonApi/Schemas/Folder.php
index f2c5608ec4cab1e0dd7469f6a8eb0fcf68ee0728..1cd5ba55a5f7f98e943f94d7bc9ce32a440ace36 100644
--- a/lib/classes/JsonApi/Schemas/Folder.php
+++ b/lib/classes/JsonApi/Schemas/Folder.php
@@ -53,7 +53,6 @@ class Folder extends SchemaProvider
     public function getRelationships($resource, ContextInterface $context): iterable
     {
         $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
 
         $relationships = [];
 
diff --git a/lib/classes/JsonApi/Schemas/InstituteMember.php b/lib/classes/JsonApi/Schemas/InstituteMember.php
index dbfe9170c6ca812d7fbff0376633ea4c2fa07742..6777a2344c4a354ffcea57c76463b2cb0706f949 100644
--- a/lib/classes/JsonApi/Schemas/InstituteMember.php
+++ b/lib/classes/JsonApi/Schemas/InstituteMember.php
@@ -43,9 +43,6 @@ class InstituteMember extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [
             self::REL_USER => [
                 self::RELATIONSHIP_LINKS => [
diff --git a/lib/classes/JsonApi/Schemas/LibraryFile.php b/lib/classes/JsonApi/Schemas/LibraryFile.php
index 9073acb91ef8953022efc6e2e0a32e4c6fef37f8..febcc100f62555e5af9e2580342eff1187016f66 100644
--- a/lib/classes/JsonApi/Schemas/LibraryFile.php
+++ b/lib/classes/JsonApi/Schemas/LibraryFile.php
@@ -76,9 +76,6 @@ class LibraryFile extends SchemaProvider
      */
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         $relationships = $this->getFeedbackRelationship($relationships, $resource);
diff --git a/lib/classes/JsonApi/Schemas/Message.php b/lib/classes/JsonApi/Schemas/Message.php
index 801c59ed18f17bb3b6f5ff35d8ce2b45b01f69b8..eeefe25094d1f07022997ee0c6cabdf950053213 100644
--- a/lib/classes/JsonApi/Schemas/Message.php
+++ b/lib/classes/JsonApi/Schemas/Message.php
@@ -34,6 +34,7 @@ class Message extends SchemaProvider
     {
         $relationships = [];
 
+        $isPrimary = $context->getPosition()->getLevel() === 0;
         if ($isPrimary) {
             $relationships = $this->getSenderRelationship($relationships, $message, $this->shouldInclude($context, self::REL_SENDER));
             $relationships = $this->getRecipientsRelationship($relationships, $message, $this->shouldInclude($context, self::REL_RECIPIENTS));
diff --git a/lib/classes/JsonApi/Schemas/ScheduleEntry.php b/lib/classes/JsonApi/Schemas/ScheduleEntry.php
index e737e614770d2c286b8da329a4dd4ec979aba3b1..3318f358b64ce2af734ad17a315f02a6ada2f93c 100644
--- a/lib/classes/JsonApi/Schemas/ScheduleEntry.php
+++ b/lib/classes/JsonApi/Schemas/ScheduleEntry.php
@@ -36,9 +36,6 @@ class ScheduleEntry extends SchemaProvider
      */
     public function getRelationships($entry, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $link = $this->createLinkToResource($entry->user);
 
         $relationships = [
diff --git a/lib/classes/JsonApi/Schemas/SemType.php b/lib/classes/JsonApi/Schemas/SemType.php
index eb44e93f29a04873283504b782992609a21cd775..46b2e3ca84a9efab562a71aa73ad38f641f61e8b 100644
--- a/lib/classes/JsonApi/Schemas/SemType.php
+++ b/lib/classes/JsonApi/Schemas/SemType.php
@@ -28,9 +28,6 @@ class SemType extends SchemaProvider
 
     public function getRelationships($resource, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         // SemClass
diff --git a/lib/classes/JsonApi/Schemas/SeminarCycleDate.php b/lib/classes/JsonApi/Schemas/SeminarCycleDate.php
index 531b58bfcb4cd850dcf17360629d8379b2f2fbe1..355e85682b94810d576c6bb6645dea16d0f3ad59 100644
--- a/lib/classes/JsonApi/Schemas/SeminarCycleDate.php
+++ b/lib/classes/JsonApi/Schemas/SeminarCycleDate.php
@@ -40,9 +40,6 @@ class SeminarCycleDate extends SchemaProvider
      */
     public function getRelationships($entry, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
-
         $relationships = [];
 
         if ($course = \Course::find($entry->seminar_id)) {
diff --git a/lib/classes/JsonApi/Schemas/StudipComment.php b/lib/classes/JsonApi/Schemas/StudipComment.php
index 7ba2a2d0ba7734ee6cb761d9afe0cb24c0e9a595..0232c15024a41cab9cd7a0e97a202b202faf0801 100644
--- a/lib/classes/JsonApi/Schemas/StudipComment.php
+++ b/lib/classes/JsonApi/Schemas/StudipComment.php
@@ -28,7 +28,6 @@ class StudipComment extends SchemaProvider
     public function getRelationships($comment, ContextInterface $context): iterable
     {
         $isPrimary = $context->getPosition()->getLevel() === 0;
-        $includeList = $context->getIncludePaths();
 
         $relationships = [];
 
diff --git a/lib/classes/JsonApi/Schemas/StudipNews.php b/lib/classes/JsonApi/Schemas/StudipNews.php
index 98b2dc50f7dda8d2a25205a721c79dfc058086c6..1bf766aee4ead80ce1b1b6c0c9720ae59d42a752 100644
--- a/lib/classes/JsonApi/Schemas/StudipNews.php
+++ b/lib/classes/JsonApi/Schemas/StudipNews.php
@@ -56,7 +56,6 @@ class StudipNews extends SchemaProvider
      */
     public function getRelationships($news, ContextInterface $context): iterable
     {
-        $isPrimary = $context->getPosition()->getLevel() === 0;
         $includeList = $context->getIncludePaths();
 
         $relationships = [];