Moved repeated code to shared service