         callback new KodingError 'Provider is not supported'
         return
 
-      credData = new JCredentialData { meta, originId }
-      credData.save (err) ->
+      CredentialStore.create client, { meta, originId }, (err, identifier) ->
         return  if failed err, callback
 
-        { identifier }   = credData
-        _data            = { provider, title, identifier, originId }
+        _data = { provider, title, identifier, originId }
 
         if provider in ['custom', 'userInput']
           _data.fields   = (Object.keys meta) or []

  JGroup             = require '../group'
  JCredentialData    = require './credentialdata'
  { PROVIDERS }      = require './computeutils'

  KodingError        = require '../../error'


hat       = require 'hat'
jraphical = require 'jraphical'

module.exports = class JCredential extends jraphical.Module

