public RemoteIssue CreateRemoteIssue(Issue issue)
        {
            var remoteIssue = new RemoteIssue {
                summary = issue.Summary,
                description = issue.Description,
                project = issue.Project,
                type = issue.IssueType,
                assignee = issue.Assignee
            };

            return remoteIssue;
        }
        public Issue CreateIssue(string loginToken, Issue issue)
        {
            try {
                RemoteIssue request = BuildRemoteIssue(issue);
                RemoteIssue response = createIssue(loginToken, request);

                return BuildIssue(loginToken, response);
            } catch (SoapException ex) {
                ProcessException(ex);
                throw;
            }
        }
        public string CreateIssue(Issue issue)
        {
            using(IJiraSoapService service = new JiraSoapService()) {
                var token = service.login(UserName, Password);
                var types = service.getIssueTypes(token);
                var remoteIssue = CreateRemoteIssue(issue);

                remoteIssue.project = "MP";
                remoteIssue.type = types[0].id;
                remoteIssue.assignee = "remote";

                var createdIssue = service.createIssue(token, remoteIssue);

                service.logout(token);

                return createdIssue.key;
            }
        }
        private RemoteIssue BuildRemoteIssue(Issue issue)
        {
            RemoteIssue remoteIssue = new RemoteIssue();

            remoteIssue.summary = issue.Summary;
            remoteIssue.description = issue.Description;
            remoteIssue.project = issue.ProjectKey;
            remoteIssue.type = issue.IssueType;
            remoteIssue.assignee = issue.Assignee;
            remoteIssue.id = issue.Id;
            remoteIssue.key = issue.Key;
            remoteIssue.priority = issue.Priority;
            remoteIssue.environment = issue.Environment;

            List<RemoteCustomFieldValue> customFields = new List<RemoteCustomFieldValue>();

            foreach(var issueField in issue.CustomFields) {
                customFields.Add(new RemoteCustomFieldValue() { customfieldId = issueField.Key, values = new[] { issueField.Value } });
            }

            remoteIssue.customFieldValues = customFields.ToArray();

            remoteIssue.created = issue.Created;
            remoteIssue.updated = issue.Updated;

            return remoteIssue;
        }
        private Issue BuildIssue(string loginToken, RemoteIssue remote)
        {
            var result = new Issue {
                Summary = remote.summary,
                Description = remote.description,
                Project = GetProjectNameFromKey(loginToken, remote.project),
                IssueType = remote.type,
                Assignee = remote.assignee,
                Id = remote.id,
                Key = remote.key,
                Priority = remote.priority,
                Environment = remote.environment,
                Reporter = remote.reporter,
                AffectsVersion = GetAffectsVersion(remote.affectsVersions),
                Updated = remote.updated,
                Created = remote.created,
                ProjectKey = remote.project,
                CustomFields = GetCustomFields(remote.customFieldValues),
                Status = remote.status,
            };

            return result;
        }