We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Event does not show up on "manage events" page when it is a copy
When the user copies an event and edits it, it does not show up on the event management page.

![screenshot from 2017-01-01 14-01-06](https://cloud.githubusercontent.com/assets/1583873/21581272/d8591f9e-d02a-11e6-8325-2c707636ee5d.png)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `app/helpers/wizard/clone.py`
Content:
```
1 from sqlalchemy.orm import make_transient
2 
3 from app.helpers.data import save_to_db
4 from app.helpers.data_getter import DataGetter
5 from app.models import db
6 
7 
8 def clone_row(row, event_id=None):
9     db.session.expunge(row)
10     make_transient(row)
11     row.id = None
12     if event_id:
13         row.event_id = event_id
14     save_to_db(row)
15     db.session.flush()
16     return row
17 
18 
19 def create_event_copy(event_id):
20     old_event = DataGetter.get_event(event_id)
21     event = clone_row(old_event)
22     event.name = "Copy of " + event.name
23     event.state = "Draft"
24     save_to_db(event)
25 
26     sponsors_old = DataGetter.get_sponsors(event_id).all()
27     tracks_old = DataGetter.get_tracks(event_id).all()
28     microlocations_old = DataGetter.get_microlocations(event_id).all()
29     call_for_paper_old = DataGetter.get_call_for_papers(event_id).first()
30     social_links = DataGetter.get_social_links_by_event_id(event_id).all()
31     custom_forms = DataGetter.get_custom_form_elements(event_id)
32 
33     for social_link in social_links:
34         clone_row(social_link, event.id)
35 
36     for sponsor in sponsors_old:
37         clone_row(sponsor, event.id)
38 
39     for track in tracks_old:
40         clone_row(track, event.id)
41 
42     for microlocation in microlocations_old:
43         clone_row(microlocation, event.id)
44 
45     if call_for_paper_old:
46         clone_row(call_for_paper_old, event.id)
47 
48     if custom_forms:
49         clone_row(custom_forms, event.id)
50 
51     return event
52
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/app/helpers/wizard/clone.py b/app/helpers/wizard/clone.py
--- a/app/helpers/wizard/clone.py
+++ b/app/helpers/wizard/clone.py
@@ -1,8 +1,13 @@
 from sqlalchemy.orm import make_transient
+from flask.ext import login
 
 from app.helpers.data import save_to_db
 from app.helpers.data_getter import DataGetter
 from app.models import db
+from app.models.users_events_roles import UsersEventsRoles
+from app.models.role import Role
+from app.models.email_notifications import EmailNotification
+from app.models.user import ORGANIZER
 
 
 def clone_row(row, event_id=None):
@@ -23,6 +28,17 @@
     event.state = "Draft"
     save_to_db(event)
 
+    role = Role.query.filter_by(name=ORGANIZER).first()
+    uer = UsersEventsRoles(login.current_user, event, role)
+    if save_to_db(uer, "Event saved"):
+        new_email_notification_setting = EmailNotification(next_event=1,
+                                                           new_paper=1,
+                                                           session_schedule=1,
+                                                           session_accept_reject=1,
+                                                           user_id=login.current_user.id,
+                                                           event_id=event.id)
+        save_to_db(new_email_notification_setting, "EmailSetting Saved")
+
     sponsors_old = DataGetter.get_sponsors(event_id).all()
     tracks_old = DataGetter.get_tracks(event_id).all()
     microlocations_old = DataGetter.get_microlocations(event_id).all()

{"golden_diff": "diff --git a/app/helpers/wizard/clone.py b/app/helpers/wizard/clone.py\n--- a/app/helpers/wizard/clone.py\n+++ b/app/helpers/wizard/clone.py\n@@ -1,8 +1,13 @@\n from sqlalchemy.orm import make_transient\n+from flask.ext import login\n \n from app.helpers.data import save_to_db\n from app.helpers.data_getter import DataGetter\n from app.models import db\n+from app.models.users_events_roles import UsersEventsRoles\n+from app.models.role import Role\n+from app.models.email_notifications import EmailNotification\n+from app.models.user import ORGANIZER\n \n \n def clone_row(row, event_id=None):\n@@ -23,6 +28,17 @@\n     event.state = \"Draft\"\n     save_to_db(event)\n \n+    role = Role.query.filter_by(name=ORGANIZER).first()\n+    uer = UsersEventsRoles(login.current_user, event, role)\n+    if save_to_db(uer, \"Event saved\"):\n+        new_email_notification_setting = EmailNotification(next_event=1,\n+                                                           new_paper=1,\n+                                                           session_schedule=1,\n+                                                           session_accept_reject=1,\n+                                                           user_id=login.current_user.id,\n+                                                           event_id=event.id)\n+        save_to_db(new_email_notification_setting, \"EmailSetting Saved\")\n+\n     sponsors_old = DataGetter.get_sponsors(event_id).all()\n     tracks_old = DataGetter.get_tracks(event_id).all()\n     microlocations_old = DataGetter.get_microlocations(event_id).all()\n", "issue": "Event does not show up on \"manage events\" page when it is a copy\nWhen the user copies an event and edits it, it does not show up on the event management page.\r\n\r\n![screenshot from 2017-01-01 14-01-06](https://cloud.githubusercontent.com/assets/1583873/21581272/d8591f9e-d02a-11e6-8325-2c707636ee5d.png)\r\n\n", "before_files": [{"content": "from sqlalchemy.orm import make_transient\n\nfrom app.helpers.data import save_to_db\nfrom app.helpers.data_getter import DataGetter\nfrom app.models import db\n\n\ndef clone_row(row, event_id=None):\n    db.session.expunge(row)\n    make_transient(row)\n    row.id = None\n    if event_id:\n        row.event_id = event_id\n    save_to_db(row)\n    db.session.flush()\n    return row\n\n\ndef create_event_copy(event_id):\n    old_event = DataGetter.get_event(event_id)\n    event = clone_row(old_event)\n    event.name = \"Copy of \" + event.name\n    event.state = \"Draft\"\n    save_to_db(event)\n\n    sponsors_old = DataGetter.get_sponsors(event_id).all()\n    tracks_old = DataGetter.get_tracks(event_id).all()\n    microlocations_old = DataGetter.get_microlocations(event_id).all()\n    call_for_paper_old = DataGetter.get_call_for_papers(event_id).first()\n    social_links = DataGetter.get_social_links_by_event_id(event_id).all()\n    custom_forms = DataGetter.get_custom_form_elements(event_id)\n\n    for social_link in social_links:\n        clone_row(social_link, event.id)\n\n    for sponsor in sponsors_old:\n        clone_row(sponsor, event.id)\n\n    for track in tracks_old:\n        clone_row(track, event.id)\n\n    for microlocation in microlocations_old:\n        clone_row(microlocation, event.id)\n\n    if call_for_paper_old:\n        clone_row(call_for_paper_old, event.id)\n\n    if custom_forms:\n        clone_row(custom_forms, event.id)\n\n    return event\n", "path": "app/helpers/wizard/clone.py"}], "after_files": [{"content": "from sqlalchemy.orm import make_transient\nfrom flask.ext import login\n\nfrom app.helpers.data import save_to_db\nfrom app.helpers.data_getter import DataGetter\nfrom app.models import db\nfrom app.models.users_events_roles import UsersEventsRoles\nfrom app.models.role import Role\nfrom app.models.email_notifications import EmailNotification\nfrom app.models.user import ORGANIZER\n\n\ndef clone_row(row, event_id=None):\n    db.session.expunge(row)\n    make_transient(row)\n    row.id = None\n    if event_id:\n        row.event_id = event_id\n    save_to_db(row)\n    db.session.flush()\n    return row\n\n\ndef create_event_copy(event_id):\n    old_event = DataGetter.get_event(event_id)\n    event = clone_row(old_event)\n    event.name = \"Copy of \" + event.name\n    event.state = \"Draft\"\n    save_to_db(event)\n\n    role = Role.query.filter_by(name=ORGANIZER).first()\n    uer = UsersEventsRoles(login.current_user, event, role)\n    if save_to_db(uer, \"Event saved\"):\n        new_email_notification_setting = EmailNotification(next_event=1,\n                                                           new_paper=1,\n                                                           session_schedule=1,\n                                                           session_accept_reject=1,\n                                                           user_id=login.current_user.id,\n                                                           event_id=event.id)\n        save_to_db(new_email_notification_setting, \"EmailSetting Saved\")\n\n    sponsors_old = DataGetter.get_sponsors(event_id).all()\n    tracks_old = DataGetter.get_tracks(event_id).all()\n    microlocations_old = DataGetter.get_microlocations(event_id).all()\n    call_for_paper_old = DataGetter.get_call_for_papers(event_id).first()\n    social_links = DataGetter.get_social_links_by_event_id(event_id).all()\n    custom_forms = DataGetter.get_custom_form_elements(event_id)\n\n    for social_link in social_links:\n        clone_row(social_link, event.id)\n\n    for sponsor in sponsors_old:\n        clone_row(sponsor, event.id)\n\n    for track in tracks_old:\n        clone_row(track, event.id)\n\n    for microlocation in microlocations_old:\n        clone_row(microlocation, event.id)\n\n    if call_for_paper_old:\n        clone_row(call_for_paper_old, event.id)\n\n    if custom_forms:\n        clone_row(custom_forms, event.id)\n\n    return event\n", "path": "app/helpers/wizard/clone.py"}]}