Logic hook relating account and meeting to bug

I am developing a before_save logic hook to related a bug to an account and a meeting. I have added the meeting relationship to Bugs in studio. They both show up as subpanels and relationships can be added manually. The logic_hook relates the account based on the account relationship of the bug that spawned the bug based on the id stored in the gen_bug_id field. That part was working fine. I added a second section of code to relate the bug to a meeting based on get_full_list criteria. This finds the meeting but instead of creating a realationship it modifies the meeting so that the bug shows up as the parent of the meeting. I don’t want the meeting changed, I want the meeting to show up as a related item in the bug. Can anybody tell me what I am doing wrong? Thanks a lot

<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class BugLinks
{
        function LinkToAccount($bean, $event, $arguments)
        {
                if (!$bean->auto_schedule_c == 0)
                {
                        $bean1 = BeanFactory::getBean('Bugs', $bean->gen_bug_id_c);
                        if ($bean1->load_relationship('accounts'))
                        {
                                $relatedBeans = $bean1->accounts->getBeans();
                                $parentBean = false;
                                if (!empty($relatedBeans))
                                {
                                        reset($relatedBeans);
                                        $parentBean = current($relatedBeans);
                                        if ($bean->load_relationship('accounts'))
                                        {
                                                $bean->accounts->add($parentBean->id);
                                                if ($bean->load_relationship('meetings'))
                                                {
                                                        $meetingBeans = $bean->meetings->getBeans();
                                                        if (empty($meetingBeans))
                                                        {
                                                                $whereMeeting = "parent_id = '" . $parentBean->id  . "' and gen_meeting_id_c = '" . $bean->gen_meeting_id_c . "' and gen_frequency_c = " . $bean->frequency_c;
                                                                $meetingBean = BeanFactory::getBean('Meetings');
                                                                $beanList = $meetingBean->get_full_list(
                                                                        "date_start",
                                                                        $whereMeeting
                                                                );
                                                                if (!empty($beanList))
                                                                {
                                                                        foreach($beanList as $nextBean)
                                                                        {
                                                                                $bean->meetings->add($nextBean->id);
                                                                        }
                                                                }
                                                                else
                                                                {
                                                                        $GLOBALS['log']->fatal("beanList empty");
                                                                }
                                                        }
                                                                 }
                                                        }
                                                        else
                                                        {
                                                                foreach($meetingBeans as $nextBean)
                                                                {
                                                                        $GLOBALS['log']->fatal("meeting found " . $nextBean->id);
                                                                }
                                                        }
                                                }
                                        }
                                }
                                else
                                {
                                                $GLOBALS['log']->fatal("related beans empty");
                                }
                        }
                        else
                        {
                                        $GLOBALS['log']->fatal("accounts not loaded");
                        }
                }
                $bean->auto_schedule_c = 0;
                //$bean->save();
        }
}
?>

I solved this by creating a new many to many Bug to Meeting relationship. It seems like the many to one relationship was the problem. That seems odd to me, why would adding a relationship that is not the parent relationship overwrite the parent relationship? This code works as long as the relationship is many to many for anybody else interested but I wonder if the effect on the parent relationship is a bug.