/// <summary>
        /// Creates or updates the current APConnection object on the server side.
        /// Incase any of the endpoints contains a new APObject, then that object will be created as well on the server side.
        /// </summary>
        /// <param name="specificRevision">
        /// Revision number for this connection instance.
        /// Used for <a href="http://en.wikipedia.org/wiki/Multiversion_concurrency_control">Multiversion Concurrency Control</a>.
        /// If this version does not match on the server side, the Save operation will fail. Passing 0 disables the revision check.
        /// </param>
        /// <param name="throwIfAlreadyExists">Flag indicating that the operation should throw incase a connection is being created when it already exists on the server side. Passing false will return the existing instance of the connection.</param>
        /// <param name="forceUpdate">Setting this flag as True will force an update request even when the state of the object may not have changed locally.</param>
        /// <returns>Returns the saved connection object.</returns>
        public async Task <APConnection> SaveAsync(int specificRevision = 0, bool throwIfAlreadyExists = false, bool forceUpdate = false, ApiOptions options = null)
        {
            try
            {
                await this.SaveEntityAsync(specificRevision, forceUpdate, options);

                return(this);
            }
            catch (DuplicateObjectException)
            {
                if (throwIfAlreadyExists == true)
                {
                    throw;
                }
            }
            // Get existing connection.
            return(await APConnections.GetAsync(this.Type, this.Endpoints.EndpointA.ObjectId, this.Endpoints.EndpointB.ObjectId));
        }
 protected override async Task <Entity> FetchAsync(ApiOptions options = null)
 {
     return(await APConnections.GetAsync(this.Type, this.Id, options));
 }