   Implements GenServer callback.
   """
   def start_link do
-  IO.puts "Made it to start_link"
     GenServer.start_link(__MODULE__, %{})
   end
 

  def register_all_jobs() do
    FeedSource
    |> Repo.all()
    |> Enum.map(&register_job/1)
  end

  @doc """

  @doc """
  Process feed and create new entries, see fetch_feed/1.
  """
  def process_feed(feed_source, body) do
    case FeederEx.parse(body) do
      {:ok, feed, _} ->
        # Update feed source record.
        feed_map = Map.put(Map.from_struct(feed), :last_retrieved, Ecto.DateTime.utc())
        feed_source_changeset = FeedSource.changeset(feed_source, feed_map)
        case Repo.update(feed_source_changeset) do
          {:ok, _feed_source} -> Enum.map(feed.entries, &(spawn(Aggit.FetchJob, :process_feed_entry, [feed_source, &1])))
          _ -> Logger.error("Unable to update FeedSource with id #{Integer.to_string(feed_source.id)}")
        end
      _ -> Logger.error("Unable to parse feed data from #{feed_source.feed_url} [#{Integer.to_string(feed_source.id)}]")
    end
  end

  @doc """
  Process individual feed entry, see process_feed/2.
  """
  def process_feed_entry(feed_source, feed_entry) do
    feed_entry_changeset = FeedEntry.changeset(%FeedEntry{}, Map.from_struct(feed_entry))
    Repo.insert_or_update(feed_entry_changeset)
  end

  @doc """
