Implement ability to add repository to team (redux)

Porting #546 over to this release. 

Just a bit of merge :poop: because I'd left it for so long.