Fixing repository refactor, adding attachment count