public Credential Map(CreateOrEditViewModel createOrEdit)
        {
            Credential credential = new Credential();

              if (createOrEdit.Id != null)
            credential = this.handler.Storage.GetRepository<ICredentialRepository>().WithKey((int)createOrEdit.Id);

              else credential.UserId = createOrEdit.UserId;

              credential.CredentialTypeId = createOrEdit.CredentialTypeId;
              credential.Identifier = createOrEdit.Identifier;

              if (!string.IsNullOrEmpty(createOrEdit.Secret))
            credential.Secret = createOrEdit.ApplyMd5HashingToSecret ? MD5Hasher.ComputeHash(createOrEdit.Secret) : createOrEdit.Secret;

              return credential;
        }
        public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit)
        {
            if (this.ModelState.IsValid)
              {
            Credential credential = new CreateOrEditViewModelMapper(this).Map(createOrEdit);

            if (createOrEdit.Id == null)
              this.Storage.GetRepository<ICredentialRepository>().Create(credential);

            else this.Storage.GetRepository<ICredentialRepository>().Edit(credential);

            this.Storage.Save();
            return this.Redirect(this.Request.CombineUrl("/backend/credentials"));
              }

              return this.CreateRedirectToSelfResult();
        }