Modifying entry with 'onBeforeSaveEntry' event I'm trying to modify a field on an entry before it is saved.

What I'm trying to do is use a field from a linked entry to populate the same field on the entry being saved. 

From logging I know the event is triggered, and that I can access the seo variable on the linked element.

Edit: The field I'm trying to copy the content from is the SEO field supplied by the sprout SEO plugin. 

However when I try to set the field on the main entry with the content from the linked one, I get the following message


  Property "Craft\EntryModel.seo" is not defined.


So my question is, how can I correctly set the seo field on the entry being saved? 



Below you can see the code currently in my plugins init function.

craft()-&gt;on('entries.onBeforeSaveEntry', function(Event $event) {
    $entry = $event-&gt;params['entry'];

    if($entry-&gt;type['handle'] === 'service'){
        $serviceContent = $entry-&gt;linkToService-&gt;first();
        $event-&gt;params['entry']-&gt;seo = $serviceContent-&gt;seo;

        // Tried this aswell, gives second error mentioned below
        $entry-&gt;getContent()-&gt;seo = $serviceContent-&gt;seo;
    }
 );




After trying the answer provided by @justussimon91, the error message changed to: 


  Property "Craft\SproutSeo_MetadataModel.metadata" is not defined.


Now this might be related to something specific with the Sprout SEO plugin so I'll raise the issue there as well.
Sprout SEO is a conjunction of different fields when you save an entry it will send the values from the Sprout SEO field (title, description, ogImage, etc..) in the 'metadata' namespace. So, in order to override this value, you can follow the next example:

craft()-&gt;on('entries.onBeforeSaveEntry', function(Event $event) {
    $entry = $event-&gt;params['entry'];

       if($entry-&gt;type['handle'] === 'service'){
          $serviceContent = $entry-&gt;linkToService-&gt;first();

          $seo = $entry-&gt;getContent()-&gt;seo;
          $seo['metadata']['optimizedDescription'] = "Override description value";
          // Update it in the post request
         $entry-&gt;setContentFromPost(array('seo' =&gt; $seo));
      }
});


In this example I override the 'optimizedDescription' you can see all the properties in the 'sproutseo/models/SproutSeo_MetadataModel.php' File.

Remember that you can also override any value on the front-end using Template Overrides or add a Custom Format to specific values like the title or description using twig logic on your Sprout SEO field settings