Extracting commong logic to a trait