Image copyright Getty Images Image caption Asan N'Jie plays the character of Ellis Chapman in ITV's Emmerdale

Imagine you're writing the plot for a series with complicated and intricate storylines and suddenly you're told one of the actors can't film any more episodes.

It's your job to explain what's happened to them - and make it add up for the overall plot.

Sounds stressful, right?

Well, that's what Emmerdale writers are going through.

Actor Asan N'Jie's contract has been terminated instantly following an incident at an awards ceremony.

Image copyright Amy Brammall/ITV Image caption Asan's character won't be appearing in The Woolpack anymore

The Mirror, who broke the original story, reports that Asan N'Jie has filmed six weeks worth of Emmerdale episodes which will be broadcast, and during that time, the story team will work on disentangling him from the plot.

So how do you make sense of someone's sudden disappearance?

"It's a challenge," according to a TV writer, who has worked on storyline teams.

She doesn't want to be named, because of the sensitive nature of the topic.

"Their first priority is to find a way to exit that character and explain their absence on screen."

Any scenes being filmed in the coming weeks are always the priority.

But it's not as simple as explaining the absence of that one character. What if they had a boyfriend, girlfriend, mum, dad, sister or brother?

"One character's absence will impact a whole range of characters' stories."

And if it's a major character who is being cut, it becomes a "massive overhaul of everything".

Unfortunately for the story team, there aren't any easy "one-size-fits-all excuses" for the sudden departure of a character.

In the short term, the writer tells Radio 1 Newsbeat a good temporary fix is to say the character has gone away to visit family.

"It has to make sense and be in line with their character, you want to make it as satisfying as possible for the audience to watch."

Re-casting

Image copyright Getty Images Image caption Kim Medcalf as Sam Mitchell won a National TV Award in 2002 for most popular newcomer

Potentially the easiest option is to just hire someone new and keep the storyline as it was. But a change of actor can be quite jarring.

In 2002, the character of Sam Mitchell in EastEnders was reintroduced - but instead of Danniella Westbrook, Sam was played by Kim Medcalf.

Westbrook then returned to the role years later, with no eyelids batted.

Ben Mitchell has famously been played by numerous people since his on-screen birth in EastEnders in 1996, and in 2019 Max Bowden took over from Harry Reid.

Image copyright Getty Images Image caption Max Bowden took over the role from Harry Reid overnight.

'It was all a dream'

When a member of the cast leaves, it's all well and good killing them off in the script - until they want to come back.

In an infamous episode of American soap, Dallas, a woman woke to find her husband in the shower - despite him definitely dying in a previous episode.

The story team got around that one by saying the entire plot of his death was all a dream. Creative, right?

Follow Newsbeat on Instagram, Facebook, Twitter and YouTube.

Listen to Newsbeat live at 12:45 and 17:45 weekdays - or listen back here.