Thanks to your question I looked into it once more and was able to refactor it even further. 3 lines are left, I think less isn't quite possible :P The set_role_from_staff_to_student method is still bothering me but I'll keep that for another day. https://github.com/tkowark/hpi-hiwi-portal/commit/6fb18ff1122310527fab4bb7249cf7cb3cb86d61