public async Task <CommandResult> Handle(CreateSnapshotCommand command)
        {
            var client = await clientService.GetClientOrDefault(command.ClientId);

            if (client == null || string.IsNullOrWhiteSpace(client.Group))
            {
                return(CommandResult.Failure("Could not find client with group. Can only create snapshot for client with group"));
            }
            var models  = configurationModelRegistry.GetConfigurationRegistrations(true);
            var version = configurationModelRegistry.GetVersion();
            var configurationIdentity = new ConfigurationIdentity(client, version);
            var snapshotInfo          = new SnapshotEntryInfo
            {
                Id        = Guid.NewGuid().ToString(),
                GroupId   = client.Group,
                Name      = command.Name,
                TimeStamp = DateTime.UtcNow
            };
            var configurations = new List <ConfigInstance>();

            foreach (var model in models)
            {
                var configurationInstance = await configurationService.GetAsync(model.ConfigType, configurationIdentity);

                configurations.Add(configurationInstance);
            }

            await snapshotRepository.SaveSnapshot(new ConfigurationSnapshotEntry { Info = snapshotInfo, Configurations = configurations });

            return(CommandResult.Success());
        }
        /// <summary>
        /// Get snapshot by id
        /// </summary>
        /// <param name="snapshotId">snapshot id</param>
        /// <param name="targetConfigurationIdentity">snapshot id</param>
        /// <returns>Snapshot entry for Id</returns>
        public async Task <ConfigurationSnapshotEntry> GetSnapshot(string snapshotId, ConfigurationIdentity targetConfigurationIdentity)
        {
            var snapshots = await GetSnapshots();

            var correctsnapShot = snapshots.SingleOrDefault(s => string.Equals(s.Id, snapshotId, StringComparison.OrdinalIgnoreCase));
            var configs         = await connector.GetSnapshotEntries(snapshotId);

            var registrations         = modelRegistry.GetConfigurationRegistrations(true).ToDictionary(k => k.ConfigurationName, StringComparer.OrdinalIgnoreCase);
            var configurationInstance = BuildConfigInstances(configs, registrations, targetConfigurationIdentity).ToArray();

            return(new ConfigurationSnapshotEntry {
                Info = correctsnapShot, Configurations = configurationInstance
            });
        }