/// <summary> /// Handles the command. Actual instance of the command being executed is passed-in as argument /// </summary> /// <param name="command">Actual command instance being executed</param> public void Execute(Command command) { var resource = _repository.GetByKey(command.Key); var now = DateTime.UtcNow; if (resource == null) { return; } var translation = resource.Translations.FindByLanguage(command.Language); if (translation == null) { var newTranslation = new LocalizationResourceTranslation { Value = command.Translation, Language = command.Language.Name, ResourceId = resource.Id, ModificationDate = now }; _repository.AddTranslation(resource, newTranslation); } else { translation.Value = command.Translation; translation.ModificationDate = now; _repository.UpdateTranslation(resource, translation); } resource.ModificationDate = now; resource.IsModified = true; _repository.UpdateResource(resource); _configurationContext.CacheManager.Remove(CacheKeyHelper.BuildKey(command.Key)); }