class KPM::PluginsManager

def add_plugin_identifier_key(plugin_key, plugin_name, language, coordinate_map)

def add_plugin_identifier_key(plugin_key, plugin_name, language, coordinate_map)
  identifiers = read_plugin_identifiers
  # If key does not already exists or if the version in the json is not the one we are currently installing we update the entry, if not nothing to do
  if !identifiers.key?(plugin_key) ||
     (coordinate_map && identifiers[plugin_key]['version'] != coordinate_map[:version])
    entry = { 'plugin_name' => plugin_name }
    entry['language'] = language
    if coordinate_map
      entry['group_id'] = coordinate_map[:group_id]
      entry['artifact_id'] = coordinate_map[:artifact_id]
      entry['packaging'] = coordinate_map[:packaging]
      entry['classifier'] = coordinate_map[:classifier]
      entry['version'] = coordinate_map[:version]
    end
    identifiers[plugin_key] = entry
    write_plugin_identifiers(identifiers)
  end
  identifiers
end