Sort friends in go and move some of the friend related code into a model