rename attahcment to connected_object

- to prevent name clash when adding paperclip attachment

- extract duplicate attach/discard methods in entities models into a
  module