Move the attributes stuff to a helper class.