private SystemResult <string> SaveToFile(string path, NintexObject nintexObject)
        {
            _urlShorteningFileService.AppendToFile(path, nintexObject.ToString());

            return(new SystemResult <string>
            {
                ResultObject = nintexObject.Key
            });
        }
        private SystemResult <bool> IsKeyExists(string path, string key, bool setErrorIfExists, out string value)
        {
            value = string.Empty;

            bool isFileExists = _urlShorteningFileService.FileExists(path);

            if (isFileExists)
            {
                if (!FilingUrlShorteningServiceStaticData.LoadedFile.ContainsKey(path))
                {
                    var fileContent = _urlShorteningFileService.ReadAllText(path);

                    if (!fileContent.IsNullOrEmpty())
                    {
                        var data = NintexObject.ConvertToNintexObject(fileContent);

                        for (var i = 0; i < data.Count; i++)
                        {
                            FilingUrlShorteningServiceStaticData.NintexObjectCache.Add(data[i].Key, data[i].OriginalUrl);
                        }
                    }

                    FilingUrlShorteningServiceStaticData.LoadedFile.Add(path, "");
                }
            }

            if (FilingUrlShorteningServiceStaticData.NintexObjectCache.TryGetValue(key, out value))
            {
                if (setErrorIfExists)
                {
                    return new SystemResult <bool>
                           {
                               HasError     = true,
                               ErrorCode    = "1001",
                               ErrorMessage = "The custom alias you've chosen is not available. We've created a random one for you instead, but you can try assigning a different custom alias again below. Use 6 characters or more for the best chance of getting a unique unassigned alias.",
                               ResultObject = true
                           }
                }
                ;
                else
                {
                    return new SystemResult <bool>
                           {
                               ResultObject = true
                           }
                };
            }

            return(new SystemResult <bool>
            {
                ResultObject = false
            });
        }