/// <summary>
        /// If found return true and int as position
        /// </summary>
        /// <param name="component"></param>
        /// <param name="edesc"></param>
        /// <returns></returns>
        public virtual bool InsertComponentEvent(IComponent component, EventDescriptor edesc, string eventMethodName, string body, out string file, out int position)
        {
            if (edesc == null)
            {
                throw new ArgumentNullException("edesc");
            }
            Reparse();

            LoggingService.Debug("Forms designer: AbstractDesignerGenerator.InsertComponentEvent: eventMethodName=" + eventMethodName);

            foreach (IMethod method in completeClass.Methods)
            {
                if (CompareMethodNames(method.Name, eventMethodName))
                {
                    file = method.DeclaringType.CompilationUnit.FileName;
                    OpenedFile openedFile = FileService.GetOpenedFile(file);
                    IDocument  doc;
                    if (openedFile != null && (doc = this.ViewContent.GetDocumentForFile(openedFile)) != null)
                    {
                        position = GetCursorLine(doc, method);
                    }
                    else
                    {
                        try {
                            position = GetCursorLine(FindReferencesAndRenameHelper.GetDocumentInformation(file).Document, method);
                        } catch (FileNotFoundException) {
                            position = 0;
                            return(false);
                        }
                    }
                    return(true);
                }
            }

            viewContent.MergeFormChanges();
            Reparse();

            file = currentClassPart.CompilationUnit.FileName;
            int line = GetEventHandlerInsertionLine(currentClassPart);

            LoggingService.Debug("-> Inserting new event handler at line " + line.ToString(System.Globalization.CultureInfo.InvariantCulture));

            if (line - 1 == this.viewContent.PrimaryFileDocument.TotalNumberOfLines)
            {
                // insert a newline at the end of file if necessary (can happen in Boo if there is no newline at the end of the document)
                this.viewContent.PrimaryFileDocument.Insert(this.viewContent.PrimaryFileDocument.TextLength, Environment.NewLine);
            }

            int offset = this.viewContent.PrimaryFileDocument.GetLine(line).Offset;

            this.viewContent.PrimaryFileDocument.Insert(offset, CreateEventHandler(edesc.EventType, eventMethodName, body, tabs));
            position = line + GetCursorLineAfterEventHandlerCreation();
            this.viewContent.PrimaryFile.MakeDirty();

            return(true);
        }